How do I enable the saveAsView option?

Posted by: kazuhiro.takeuchi on 23 October 2023, 6:10 pm EST

  • Posted 23 October 2023, 6:10 pm EST

    Hello,

    I’m testing the JSON output on the sample page.

    https://www.grapecity.com/spreadjs/demos/features/spreadjs-file-format/overview/react

    I’m trying the ’saveAsView’ option to convert the formatting set on the cell to a Static value, but it doesn’t seem to work.

    Are there any restrictions on using it?

  • Posted 24 October 2023, 8:39 pm EST

    HI,

    The saveAsView works for the format string (when we define conditional format through the format string).

    Please refer to the following attached you will notice that we you export the sheet without saveAsView option the formatter will be lost but if you enable the formatter will be displayed in excel.

    sample: https://jscodemine.grapecity.com/share/2gnRj2R3UEq7vayJEehZjA/?defaultOpen={"OpenedFileName"%3A["%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}

    The format strings demo: https://www.grapecity.com/spreadjs/demos/features/cells/formatter/format-string/purejs

    Regards,

    Avinash

  • Posted 25 October 2023, 11:00 pm EST - Updated 26 October 2023, 5:18 pm EST

    Thank you.

    I was able to see the actual operation on the sample site that you introduced.

    However, this behavior seems to be valid only for the format set by the TEXT function in the formula.

    When formatting directly with the formatter method of SpreadJS,I couldn’t see the formatting and conditional formatting I set on the designer work.

    Works

    sheet.getRange(6, 2, 12, 2)
        .hAlign(gcns.HorizontalAlign.right)
        .formatter('=TEXT(INDIRECT(ADDRESS(ROW(),COLUMN())),"#,##0.00_);(#,##0.00)');
    spread.resumePaint();

    Does not work

    sheet.getRange(6, 2, 12, 2)
        .hAlign(gcns.HorizontalAlign.right)
        .formatter('_($* #,##0.00_);_($* (#,##0.00)');
    spread.resumePaint();

    Is the specification of saveAsView correct?

  • Posted 26 October 2023, 9:15 pm EST

    Hi,

    Yes, SaveAsView will not remove the conditional formatting to the regular format string. it only handles the style format that comes from the Function such as Text

    Regards.

    Avinash

Need extra support?

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

Learn More

Forum Channels