Thanks for your query.
Well, MS Excel's Numbers formatting is a very complex feature on its own, it might involve multiple locales or other aspects, so it would be tough to determine your desired tasks/ queries etc. accurately. As your queries involve diverse scenarios, so you might not always get accurate results or expected results for certain scenarios.
For your queries/ tasks:
- Discover it is an accounting type cell? In Aspose, the style associated with the cell returns that it is a general cell rather than accounting.
Well, you may try to use Style.Number and Style.Custom attributes. But, I am afraid there is no better way to determine whether one pattern used for formatting numbers is accounting or not. For Style.Number, it should be accounting when the number returned is 5,6,7,8,42 or 44, but for custom string, I am a afraid, you have to check whether it denotes accounting by yourself.
- Discover the number of decimal places?
- Discover the currency symbol?
Well, I think you can use DisplayStringValue attribute of Cell and then use your own Java code to find or determine the currency symbol and decimal places, there is no such APIs in Aspose.Cells component. Please note, generally, it can be used to determine to do the task but for some special cases, such as 1.2, if formatting pattern is "#.###", the resultant string is "1.2". So, we are not sure whether you want the decimal places should come as 1 or 3.
- Get the number 12.346, correctly rounded to the number of decimal places set in the formatting?
You might try using Excel's Round formula or any other relevant formula/ function upon the value when extracting it from your desired cells.
- What is the difference between custom and culture custom?
- What are the exact syntax and semantics of these strings?
Well, Custom attribute denotes the formatting pattern in en-us locale, such as "$#,###.#". CultureCustom is the formatting pattern corresponding to one specified locale, such as for fr-FR locale, in MS Excel, you will see the pattern is like "$# ###,#" instead of "$#,###.#". CultureCustom is provided for the convenience of the users to get/set style as they are normally familiar with some special locales, however, it is not or cannot be fully supported for all locales and Style.Custom is always the recommended way to get/set formatting patterns.
PS. We also recommend you to kindly try our latest version/fix: Aspose.Cells for .NET v8.6.0, we made more enhancements regarding Numbers formattings.
Hope, this helps you a bit.