As you can see even though I have set all the LoadOptions to Australia the StringValue of the date has the day and the month inverted (US Format). What am I missing?
I have changed settings of my system including Region, Regional Format and Locale Settings to English (Australia) format with which MS Excel displays the values as 26/03/2019 in Column A. When I use below code then “26/03/2019” is displayed on console which is the same format as MS Excel.
LoadOptions wbLoadOptions = new LoadOptions()
{
CultureInfo = new System.Globalization.CultureInfo("en-AU"),
LanguageCode = CountryCode.Australia,
Region = CountryCode.Australia
};
var sourceWb = new Workbook("test.xls", wbLoadOptions);
Console.WriteLine(sourceWb.Worksheets[0].Cells["A2"].StringValue);
I have tested it with Aspose.Cells for .NET 19.3.2. Can you please check with this latest version and let us know your feedback.
Thank you for the quick response, my settings are all already set to Australia as you would expect and when I open the workbook the date is displayed in the same format. I am using Apose.Cells v 18.8 though so perhaps I can try upgrading to 19.3.2 and see if that fixes the issue.
I’ve been able to better reproduce the issue. I gave you a file that doesn’t reproduce the issue apologies. Please take the file attached and don’t open it or save it. It should print out the date in the American format. If you then open the workbook and save it with your locale set to Australian and run the code again it should produce the date correctly. It seems the problem is related to maybe the locale the workbook was produced on in the 1st place? test.zip (56.1 KB)
I have tried this sample file (test.xls without opening/saving it ) using your sample code but afraid to share that I could not reproduce the issue yet. It is showing me the date in Australian format as mentioned in the LoadOptions settings given below:
Aspose.Cells.LoadOptions wbLoadOptions = new Aspose.Cells.LoadOptions()
{
CultureInfo = new System.Globalization.CultureInfo("en-AU"),
LanguageCode = CountryCode.Australia,
Region = CountryCode.Australia
};
When I set the LoadOptions to USA (given below), your code displays American format date as expected.
Aspose.Cells.LoadOptions wbLoadOptions = new Aspose.Cells.LoadOptions()
{
CultureInfo = new System.Globalization.CultureInfo("en-US"),
LanguageCode = CountryCode.USA,
Region = CountryCode.USA
};
You may please try this scenario again with latest version mentioned above and share your feedback.
Regarding the dependencies issue, you may please install System.Drawing.Common via NuGet package manager as it is required now in newer versions.