Free Support Forum -

Retain the default date format in Excel cell

I’m on Aspose Cells for Java 20.2.0

I’m using SheetRender API to convert the spreadsheet into an Image (PNG).
I have an issue when the excel document contains date. For ex: In the attached test file, the column value is 24/07/1988, but the output from Aspose Cells is 7/24/1988.

Below is the sample code snippet I’m using

         ImageOrPrintOptions options = new ImageOrPrintOptions();
         SheetRender sr = new SheetRender(worksheet, options);
         sr.toImage(0, g2D);

I’m aware that Aspose is using the Region and Language Code settings and converting it into respective formats.

By using the below settings, the issue is solved


I have two questions here

  1. Is there a way to force Aspose Cells to treat the date columns as just a String data (instead of date)?
  2. When using the loadOptions.setLanguageCode and loadOptions.setLanguageCode, the delimiter between date, month, and year got changed to an hyphen (-) from forward slash (/). Is there a way t avoid this?

Note: Cell.setStyle() would not be feasible for me. Please refer to the sample code snipped pasted above (6.4 KB)


Aspose.Cells parses data in accordance with the region or locale settings of the system where the code is processed.

  1. No, for Date type or numeric values stored in native Excel files (XLS, XLSX, etc.), Aspose.Cells does not take it as strings. You got to convert the DateTime values to string to be re-inserted into the cells by yourselves for your desired range in the worksheet. Please note, we do have ConvertNumericData and ConvertDateTimeData Boolean attributes in TxtLoadOptions which can be set for text or CSV file formats only.

  2. You already told above that when setting the language and region, it works fine as per your requirements. Here you are saying it is changing delimeter from forward slash to hyphen. Do you still find the issue even after setting the region or language setting? Do you mean the Date “24/07/1988” is changed to “24-07-1988”, please elaborate with details and sample files?