Hi. I have found, that Russian months output in invalid form (not like in Excel). For example following test fails, because string value in cell not matched with Excel’s value. I’ve performed this test in different environments, but every time i have incorrect result:
@Test
public void month() throws Exception {
Workbook wb = new Workbook("D://in.xlsx");
Cell cell = wb.getWorksheets().get(0).getCells().get("A1");
assertEquals("Июль 2018", cell.getDisplayStringValue());
}
org.junit.ComparisonFailure:
Expected :Июль 2018
Actual :июля 2018
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
This issue has been logged as
CELLSJAVA-42688 - Invalid date format output
Moreover, from security point of view XLS, XLSX or XLSM files are not allowed to be uploaded directly as there can be spams (written in different scripts) which can be renamed to XLS/XLSX files. So we recommend archiving the files and uploading them to forums.
Please see our reply for the same issue posted by another user:
Here, by our tests we can get the correct results for A1’s StringValue: Июль 2018. The formatted result should be determined by the installed JDK of your environment. You may check whether SimpleDateFormat with pattern “MMMM” and Russian locale can give the expected result without referencing to/using our component.
Thank you for link. Can you please provide JDK version, that you used for test and (if it is possible) - a small piece of code, that returns “Июль 2018” from library.
I asked it, because it very strange, that this issue was raised recently.
I’m using jdk 1.8.181 (switching default locale not influence on result)
Could you check whether SimpleDateFormat with pattern “MMMM” and Russian locale gives your the expected results or not without involving Aspose.Cells APIs?
It is too complex to check every time a cell’s format and use SimpleDateFormat with different formats, that used for cell. Easier to find some environment difference and fix it.
For “try SimpleDateFormat with pattern “MMMM” and Russian locale”, it is not to require you to try it for every cell, but you may just try the code like following:
e.g Sample code:
System.out.println(new SimpleDateFormat("MMMM yyyy", new Locale("ru", "RU")).format(new Date(2018,6,11)));
and verify whether it can give the expected results with your Java environment or not.
By our further investigation, we found it is the JDK who changed its behavior for formatting, it is not an issue with Aspose.Cells APIs. For JDK1.6, the output is just same with the expected one. But for JDK1.8, it gives the “incorrect” result. Currently we cannot find any solution for JDK1.8 to let it to format same with 1.6 or cope with it.
As we told you that we could not find any solution for JDK1.8 for your issue. Anyways, if there is any new information to be shared, we will let you know.
In Java 8 class SimpleDateFormat has 2 types “Month in year” pattern letters.
M - Month in year (context sensitive)
L - Month in year (standalone form)
So, if I use code: System.out.println(new SimpleDateFormat("MMMM yyyy", new Locale("ru", "RU")).format(new Date()));
It returns "августа 2018"
But, if I use: System.out.println(new SimpleDateFormat("LLLL yyyy", new Locale("ru", "RU")).format(new Date()));
It returns “Август 2018”, as we need.
This is to inform you that we have fixed your issue now. We will soon provide you the fix after performing QA and incorporating other enhancements and fixes.
The issues you have found earlier (filed as CELLSJAVA-42688) have been fixed in Aspose.Cells for Java 18.10. You can also get the latest Aspose.Cells for Java version from Maven repos. with simple configurations. Please see the document for your reference: Installation|Documentation
This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi
I opened your template file into MS Excel but A2 cell is not Russian (custom) formatted (it is simple custom formatted), see the screenshot for your reference: https://i.imgur.com/GtE1QQ3.png