Override windows region and datetime

Hi guys, we are trying to set a region and datetime format(it is USA format mm/dd/yyyy with slash delimiter) for all regions using our app. Is it possible override windows region and datetime format in excel ? Our app written in .Net and fields need to be formatted is DateTime so string related solutions does not work for us. Also we tried chaging culture, region and even delimiter setting in aspose but still our users in serbia getting date with dot delimiter.

Have a nice week!

@ocelllotatata,
You can refer to the document:

Hi John, thanks for taking time to answer but we already tried that and it is not working. It is always showing as regional format data of windows.

@ocelllotatata,
Would you like to provide your template file and the executable Console project? We will check it soon.

@ocelllotatata,

We are looking forward to get your sample project and sample files. By the way, you may specify region or locale settings in code, so the formatted datetime or numbers should be rendered accordingly. Please see the following sample code that works fine and as expected as I tested:
e.g.
Sample code:

LoadOptions options = new LoadOptions();
options.Region = CountryCode.Germany;//you may change it accordingly
Workbook _document = new Workbook("e:\\test2\\Book1.xlsx", options);
_document.Save("e:\\test2\\out1.pdf", new PdfSaveOptions());

@ocelllotatata,

Are you formatting the datetime value with Aspose.Cells and showing the formatted result to users in UI(your app) or generating excel file for users and then users open the generated file at their end?

If you are formatting datetime value and showing formatted result for users in your own UI, as @amjad.sahi recommend, you may set the same regional settings for all workbooks to get the same results.

If you are generating excel files for users and users open the file at their own environment, the used regional settings will be determined by their environment, it is ms excel’s behavior and our component cannot control or change it. For such situation, you may try to use custom format for those cells, such as mm"/“dd”/"yyyy, the quoted “/” will not be changed by ms excel for different regions.

@John.He Tomorrow, I may be sharing a template console project.
@amjad.sahi We set the region from workbook settings, plus we are creating workbook in the code I guess this code does not apply for us.
@johnson.shi You are right, we changed application cultureinfo and it solved some part but still while user editing at their end it is still with dot delimiter. As you said it is ms excel’s behavior. Thanks for the support guys. I’m really appreciated.

@ocelllotatata

Dose the solution of custom format with quoted “/” solve your issue? Or do you need more help for formatting the date time? If you still think there is some issue about the function, please describe your scenario with more details so we can help further.

Yes it is solved my issue, thanks!

@ocelllotatata,

It is nice to know that the suggested solution figures out your issue. Feel free to write us back if you have further queries or comments, we will be happy to assist you soon.