Export PDF recalculate formulas without asking

Posted by: Fabrice.Mainguene on 16 October 2024, 9:08 am EST

  • Posted 16 October 2024, 9:08 am EST

    Hi,

    I use the designer’s export PDF, and I encounter some issues when I use the NOW() formula or asynchronous function in my document.

    Before the PDF is created, Spreadjs seems to recalculate all the formulas of the document and I have 2 issues with that:

    1- NOW() formula is recalculated, so my date time is wrong in my pdf

    2- the creation of the pdf begins before the end of the execution of all the asynchronous functions, so I have some cells with a “loading…” instead of the correct value

    Why do you recalculate the formulas when I didn’t ask for anything?

    Is there a way to not recalculate the document and just print my current document in pdf?

  • Posted 17 October 2024, 6:39 am EST - Updated 17 October 2024, 6:44 am EST

    Hi,

    From my understanding, you’re using the NOW and asynchronous formulas in SpreadJS (SJS), and when exporting to PDF, the NOW value is recalculated, causing it to change, while the asynchronous formula shows the default “loading…” value in the PDF.

    I attempted to replicate this behavior but was unable to do so. On my end, after exporting as pdf, the NOW formula value remained unchanged, and the asynchronous formula did not display the default “loading…” value in pdf. Please refer to the attached gif “Steps.gif” and the provided sample for reference.

    Gif:

    Sample: https://jscodemine.mescius.io/share/-ZEJKRhzxUWDPfKoJpJoZw/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fpackage.json"]%2C"ActiveFile"%3A"%2Fpackage.json"}

    To better assist you, could you share a minimal working sample along with the steps to replicate the behavior you have observed, or modify the existing sample to replicate the behavior? This will enable me to investigate the problem more thoroughly. Additionally, It would be helpful if you could provide a GIF or video illustrating the issue.

    Regards,

    Priyam

  • Posted 17 October 2024, 9:06 am EST - Updated 17 October 2024, 9:11 am EST

    Hi,

    Thanks to test my case.

    So I’m not agree with you :slight_smile:

    OK my understanding of the Now() formula was not good, but as you can see in your example, the time that appear in the document before and after the pdf export is not the same.



    I just need an export, not a recalculation of my document before or after the export. Unwanted recalculation can lead to major bugs.

    For the asynchronous functions I need to do extra tests.

  • Posted 18 October 2024, 8:32 am EST - Updated 18 October 2024, 8:37 am EST

    Hi,

    I noticed that the value of the NOW function changes before and after exporting to PDF in SJS. I have escalated this issue to the concerned team with the internal tracking ID “SJS-26923”. I will keep you updated as soon as I receive more information.

    As a workaround, you can switch the calculation mode to manual from auto when exporting to PDF to prevent recalculations. Refer to the attached gif “Steps.gif” for details.

    Gif:

    If you wish to set this programmatically, use the following code:

    spread.options.calculationMode = GC.Spread.Sheets.CalculationMode.manual

    For more information on calculations in SJS, you can refer to this demo: https://developer.mescius.com/spreadjs/demos/features/calculation/calc-service/purejs

    Regards,

    Priyam

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels