Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable AutoCalculate? #207

Closed
miztaka opened this issue May 15, 2020 · 2 comments
Closed

How to disable AutoCalculate? #207

miztaka opened this issue May 15, 2020 · 2 comments

Comments

@miztaka
Copy link

miztaka commented May 15, 2020

In a server application, when you convert libreoffice calc file to pdf, cell is auto calculated and some vulnerable formulas (such as =WEBSERVICE) are executed.

I want to turn AutoCalculate off before conversion, so server can convert all of calc files uploaded by user safely.
How can I do this?

Any help would be appreciated.

Thanks for great library!

@sbraconnier
Copy link
Member

Are you able to do it with LibreOffice (or OpenOffice) without JODConverter (using the export option)? If yes, then you should be able to do it with JODConverter using a specific Filter.

@miztaka
Copy link
Author

miztaka commented May 18, 2020

Thanks, worked with Filter!
FYI code is like this:

  @Override
  public void doFilter(OfficeContext context, XComponent document, FilterChain chain)
      throws Exception {
    Lo.qiOptional(XCalculatable.class, document).ifPresent((x) -> {
      x.enableAutomaticCalculation(false);
    });
    chain.doFilter(context, document);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants