Hi,
I want to format a date writing (in letters) the name of month. I tried like this
<<[signatureDate]:“MMMM”:lower>>
and it works. The problem is, how can I change the language about month? I need to print the name of month in Italian language and not in English.
How can I acclompish it?
Thanks
@voxopake
You need to execute the code under Italian culture. If you still face problem, please attach the following resources here for testing:
- Your input Word document.
- Please attach the output Word file that shows the undesired behavior.
- Please attach the expected output Word file that shows the desired behavior.
- Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.
Hi,
here the example test_date.zip (44.2 KB)
There is no way to “force” the report engine language? Or format directly a date inside a tag indicating also the culture? Because we are going to deploy in different server with different culture…but we need to ensure a standard date format output.
Thanks
@voxopake
Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have logged this feature request as WORDSNET-20280 in our issue tracking system. You will be notified via this forum thread once this feature is available.
We apologize for your inconvenience.
@voxopake
Please ignore my previous post and use CurrentThreadSettings.setLocale method as shown below to get the desired output.
Please note that the current thread’s locale can be set back after the report is built, if needed.
com.aspose.words.CurrentThreadSettings.setLocale("it-IT");
String json = "{\n" +
"\"root\":\n" +
"{\n" +
"\"additionalJsonProperties\":\n" +
"{\"signature_date\": \"2020-05-08\"}" +
"}";
Locale locale = new Locale( "it" , "IT" );
Document doc = new Document(MyDir + "test_Date.docx");
InputStream jsonIS = new ByteArrayInputStream(json.getBytes());
JsonDataSource ds = new JsonDataSource(jsonIS);
ReportingEngine engine = new ReportingEngine();
engine.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
engine.buildReport(doc, ds, "root");
doc.save(MyDir + "20.3_it.pdf", SaveFormat.PDF);
@voxopake
Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.