Include unused styles

Posted by: marcio.shimoda on 16 October 2023, 12:50 am EST

  • Posted 16 October 2023, 12:50 am EST

    Hello everyone!

    Does anyone know how the “Include unused styles” option works on the SJS file open screen? What does the algorithm consider as “unused styles”? When I uncheck this option, some used styles in my sheets don’t seem to load properly.

  • Posted 16 October 2023, 4:02 am EST

    Here it is the anonymized SJS file I’m using…

    spreadjs_anomyzed.zip

  • Posted 16 October 2023, 5:49 pm EST - Updated 16 October 2023, 5:54 pm EST

    Hello,

    As indicated in the following documentation (https://www.grapecity.com/spreadjs/docs/features/spreadjs-file-format#site_main_content-doc-content_title), the “includeUnusedStyles” feature determines whether named styles should be included when converting an Excel XML file to JSON. By default, this feature is set to true.

    You can create named styles within SpreadJS, and you have the option to include or exclude these named styles during the import/export process using the “includeUnusedStyles” flag. For example, if a “.sjs” file contains named styles such as “style1” and “style2,” unchecking the “Include Unused Styles” flag during the opening of the .sjs file will prevent the import of the “style1” and “style2” named styles. This setting does not consider whether the named style is actually in use; it simply controls their inclusion or exclusion during import/export.

    For clarification, please refer to the attached GIF. In it, I first create two named styles, “yellowBg” and “blueBg,” with yellow and blue background colors, respectively. Afterward, I export the .sjs file.

    When I later open the .sjs file with the “Include Unused Styles” flag checked, it includes both named styles, “yellowBg” and “blueBg,” even if they are not used.

    However, when I open the .sjs file with the “Include Unused Styles” flag unchecked, it excludes both named styles.

    I hope this explanation clarifies how the “Include Unused Styles” flag works. Please let me know if you encounter any issues.

    Additionally, I couldn’t locate any “.sjs” files attached to your message. If you are still experiencing the issue, please share the “.sjs” file with us, enabling us to investigate the matter and provide further assistance.

    Best regards,

    Ankit

  • Posted 16 October 2023, 11:43 pm EST

    Hi, Ankit!

    Thank you very much for the information.

    I attached the SJS in my message posted 16 October 2023, 4:02 am EST. I just renamed to .zip becouse this form accepts images and zip only.

    In my case, there is already an imported Excel spreadsheet in the file. SJS has the stylizations, but when I uncheck the “Include unused styles” option, some parts load, and others don’t. Considering your explanation, I imagine this happens because some of the styling was applied to cells without using a “named style.” However, I have no control over the imported XLSX.

  • Posted 17 October 2023, 1:42 am EST - Updated 17 October 2023, 1:47 am EST

    Based on the information provided, I conducted some additional tests using SpreadJS Designer.

    I opened SJS with the “Include unused styles” option unchecked as false, and as I mentioned earlier, SpreadJS loaded some of the styles. Then, I clicked on the “Cell Styles” button and discovered that some “named styles” are retained.

    What could I do to load only the necessary styles?

  • Posted 17 October 2023, 10:46 pm EST

    Hi,

    I am sorry but I couldn’t understand the issue you are facing correctly.

    Could you kindly share the sjs file you are using so that we could investigate the issue at our end? Also, kindly mention what styles you want to be included and what styles you want to be excluded.

    If you uncheck the “Include unused styles” flag, then it should not include the named styles.

    Also, you could place the “.sjs” file inside a folder and then zip the folder and share it with us. Further, if your file contains sensitive information, kindly replace it with dummy data or you create a ticket on our private portal at https://www.grapecity.com/my-account/my-support

    Regards,

    Ankit

  • Posted 17 October 2023, 11:19 pm EST

  • Posted 18 October 2023, 9:38 pm EST

    Hi,

    Thanks for sharing the file with us. I was able to observe that some named styles are not imported when the “Include Unused Style” flag is set to false. Also, in the file, only some styles seem to be missing.

    I have escalated it to the concerned dev team for further investigation. The internal tracking id for the same is: SJS-20760. I will let you know when there is further information from the dev team into this issue.

    Regards,

    Ankit

  • Posted 25 October 2023, 8:25 am EST

    Hi!

    Any updates on this topic?

  • Posted 25 October 2023, 4:06 pm EST

    Hi,

    The devs have confirmed the issue as a bug and are working on the fix. I will let you know when there is further information on this from the dev team or when the issue will be resolved.

    Regards,

    Ankit

  • Posted 27 October 2023, 4:25 am EST

    Hi!

    Could you give me an estimated delivery date to fix the problem?

    Thanks in advance.

    Marcio

  • Posted 29 October 2023, 2:20 pm EST

    Hi Marcio,

    I have asked the dev team for an ETA. I will update you once I get more information from the dev team on this.

    Regards,

    Ankit

  • Posted 30 October 2023, 4:24 pm EST

    Hi Marcio,

    The dev team has informed that till now, we don’t have ETA for this case. I will update you when there is further information from the dev team on this.

    Regards,

    Ankit

  • Posted 13 November 2023, 12:31 am EST

    Hi Ankit!

    Any updates on this topic?

  • Posted 13 November 2023, 2:52 pm EST

    Hi Marcio,

    The SpreadJS V16.2.6 just released yesterday and the issue has been fixed in the latest version. You may download the latest version using the following link: http://cdn.mescius.com/spreadjs/16.2.6/Files/SpreadJS.Release.16.2.6.zip

    Further, the devs have mentioned that when importing the sjs file with includeUnusedNamedStyle flag unchecked, the exported sjs file has no record for the namedStyle which applied to the cell. So, when importing, will have the wrong result, and it is an exporting bug.

    Therefore, the devs have mentioned that you should update the sjs file by importing the original excel file and then exporting the correct sjs file.

    For the “.sjs” file that you have shared, you will still face an issue, and you need to first import the original excel file in the latest version V16.2.6 and then generate the “.sjs” file, then the issue will be fixed.

    If you still face the issue, do let us know and share the excel file for which you faced the issue.

    Regards,

    Ankit

Need extra support?

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

Learn More

Forum Channels