We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Chart.ToImage not rendering correctly date format conforming to CultureInfo


When using Chart.ToImage and CultureInfo is set the date format in the generated image is not conforming to the date format of the CultureInfo.
To reproduce the issue use the attached XLSX file and the following code.
Please compare the date format between the image of the chart and the image of the range used as data for the chart for different CultureInfos generated by the code (I’m attaching for reference images for CultureInfo=“ja-JP”):

var workbook = new Workbook(“Chart.xlsx”);
var cultureInfos = new[] {“sv-SE”, “fr-FR”, “ja-JP”, “ru-RU”, “es-ES”};

var imageOptions = new ImageOrPrintOptions
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true,
OnlyArea = true

foreach (var cultureInfo in cultureInfos)
workbook.Settings.CultureInfo = new CultureInfo(cultureInfo);

var chart = workbook.Worksheets[0].Charts[0];
var chartImage = chart.ToImage(imageOptions);
chartImage.Save(cultureInfo + “-chart.bmp”);

workbook.Worksheets[0].PageSetup.PrintArea = “C24:D26”;
var sheetRender = new SheetRender(workbook.Worksheets[0], imageOptions);
sheetRender.ToImage(0, cultureInfo + “-range.bmp”);

Hi Sorin,

Thank you for contacting Aspose support.

Please try the same case with attached spreadsheet, and let us know if the results are up to your expectation. Please note, we have manually changed the format of the Column D to show the name of the month rather than the corresponding integer, and added the day in front of it.

If the results are not expected then please share your expected results so we may look further in to the presented scenario.

Hi Babar,

This is not exactly the issue, the problem is the date format in the chart is not respecting the date format corresponding to the CultureInfo.
For example: the date format specified by Japanese CultureInfo (“ja-JP”) is yyyy/mm/dd (see the attached screenshot of Visual Studio debug screenshot); in the attached image you can see the cells are displaying the correct date format for the Japanese CultureInfo but the chart is not respecting that format (I used red ellipses to show the difference).
The chart should display: “2013/12/10”, “2014/09/26” and “2013/12/11”.

Thank you,
Aurelian Iordache
IBM Romania

Hi Aurelian,

Thank you for elaborating the issue.

We have evaluated the presented scenario while using the latest version of Aspose.Cells for .NET, and are able to replicate the said behavior. In case of “ja-JP” & “sv-SE” culture settings, the date format in the source range and chart data labels do not match. We have logged the problem in our bug tracking system under the ticket CELLSNET-43046 for further investigation & correction purposes. Please spare us little time to properly analyze the problem cause, and to provide a fix at earliest possible. In the meanwhile, we will keep you posted with updates in this regard.

Hi Babar,

Thank you very much.
I’d just like to add a quick note - the few cultures I used in the previous code to are just the ones we tested, the issue may be affecting other cultures too, it must be investigated deeper.

Best regards,
Aurelian Iordache
IBM Romania

Hi Aurelian,

Thank you for writing back,

We have raised your concerns to the core development team by recording a note to the relevant ticket. Before announcing the fix, we will test other cases as well.


Please try our latest version/fix: Aspose.Cells for .NET v8.3.1.4

We have fixed your issue “<span lang=“EN-US” style=“font-size:11.0pt;font-family:
AR-SA”>CELLSNET-43046” now.

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSNET-43046) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.