Apply culture to all cells on spreadsheet

Posted by: thuan.tu on 19 December 2023, 10:16 pm EST

  • Posted 19 December 2023, 10:16 pm EST

    I am using GrapeCity 6.2.2 (“GrapeCity.Documents.Excel”) for my project. Our application will read a file stream and export to an excel file. However, users can choose a culture for the exported file to apply this culture. We want all dates in the file, regardless of format, to be applied with the correct culture that the user has chosen. We don’t know if just setting culture for workbooks can solve our problem? If not, can you provide us a solution? Thanks!

  • Posted 20 December 2023, 2:13 am EST

    Hi @Spreadjs team any update on this one

  • Posted 20 December 2023, 7:21 am EST

    Hello,

    The Culture property sets the culture of the workbook object. In the saved Excel file it picks the date format as per the system date.

    https://developer.mescius.com/document-solutions/dot-net-excel-api/docs/online/DS.Documents.Excel~GrapeCity.Documents.Excel.IWorkbook~Culture.html

    As a workaround, you can set the culture and modify the cell’s format as given below to achieve your desired output:

    workbook.Worksheets[0].Range["B1"].NumberFormat = workbook.Worksheets[0].Range["B1"].NumberFormat+ " ";

    Please see the attached sample implementing the same.

    Regards,

    Prabhat Sharma.

    CultureCheck.zip

Need extra support?

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

Learn More

Forum Channels