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

Free Support Forum - aspose.com

DateTime formats for Excel to PDF conversion with Aspose.Cells for .NET API in C#

Hi,

If we manipulate DateTimeFormat for CurrentCulture in our code, and then try to convert an xlsx file having a DateTimeFormat-ted cell with a value, we get an unexpected result.

Sample code could be:

CultureInfo.CurrentCulture =
new CultureInfo(“en-GB”)
{
DateTimeFormat =
new DateTimeFormatInfo
{
ShortDatePattern = “d MMMM yyyy”,
}
};

		var cellDoc = new Aspose.Cells.Workbook("d://Book2.xlsx");
		cellDoc.Save("d://CellsResult.pdf", Aspose.Cells.SaveFormat.Pdf);

The source xlsx is Book2.zip (6.4 KB)

The result looks like:

11/14 November 2019/2019
Thursday, 14 November 2019

@WorkZone,

Thanks for the sample code segment and template file.

After an initial test, I am able to reproduce the issue as you mentioned by using the following sample code with your template file. I found the DateTime formatting in the output PDF page is wrong or corrupted.
e.g
Sample code:

 var cellDoc = new Aspose.Cells.Workbook("e:\\test2\\Book2.xlsx");
            cellDoc.Settings.CultureInfo = new CultureInfo("en-GB")
            {
                DateTimeFormat = new DateTimeFormatInfo
                {
                    ShortDatePattern = "d MMMM yyyy" 
                }
            };

        cellDoc.Save("e:\\test2\\out1.pdf", Aspose.Cells.SaveFormat.Pdf); 

I have logged a ticket with an id “CELLSNET-47052” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@WorkZone,
Please try our latest version/fix: Aspose.Cells for .NET v19.11.9 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells19.11.9 For .Net2_AuthenticodeSigned.Zip (5.0 MB)
Aspose.Cells19.11.9 For .Net4.0.Zip (5.0 MB)

Hi,

thanks for the quick fix!
I’ve verified it with the provided Aspose.Cells 19.11.9 and it works fine.
We will wait for the officially published NuGet package tor our production code.

Thank you

@WorkZone,

Good to know that your issue is sorted out by the new fix/version. We are scheduled to publish our next official release (e.g Aspose.Cells for .NET v19.12) on Downloads/Nuget repos., before the end of this week. You will also be notified once the release is published.

The issues you have found earlier (filed as CELLSNET-47052) have been fixed in Aspose.Cells for .NET v19.12. This message was posted using Bugs notification tool by Amjad_Sahi