Unable to retrieve custom formatted text string values

Hi, I have a question regarding how to apply custom formats to excel cell strings.


I have a custom format such as this: (#,##0);(#,##0);(-);(@)
This custom format basically says:
- if the numeric value is positive, add a trailing space
- if the numeric value is negative, display using brackets
- if the cell is a text string, add a trailing space

As you can see with the screenshot I attached, in Excel, they align perfectly, with the first 3 values each have a trailing space, while the forth value has an end bracket. When I use Aspose to extract each of these values and put them into a Word table, I cannot get them to align. For the negative values, Aspose.Cells.Cell gives me the StringValue “(55,555)” that is exactly what I see on the UI, however, for the string value “TEXT”, Cell.StringValue only gives me “TEXT”, intead of "TEXT " with a trailing space. (The same problem existed for the positive numbers, for which I had to manually add a trailing space)

I also tried c.SetStyle() call, and I still do not see the StringValue reflecting what I see on the UI. How can I get the string that has been custom formatted?

Any help would be appreciated.

Hi,


Please separate the issue regarding Aspose.Cells for retrieving the values in the cells (which are customized formatted). Kindly attach your sample Excel file (you may create a sample Excel file manually in MS Excel) and paste your code (using Aspose.Cells APIs) to retrieve the values. We will check your issue soon.

Also, kindly do use our latest fix/version v7.3.0.5: Aspose.Cells for .NET v7.3.0.5

Thank you.

I’ve attached a sample app illustrating what I’m trying to do using v7.3.0.5. Please see attached.

Hi,

Please use Cell.DisplayStringValue instead of Cell.StringValue to get the expected result. Cell.StringValue is designed to return the text itself if cell's value is string.

Thank you.

Thank you. I did not see this DisplayStringValue property in an earlier version (7.2.0.3), can you confirm starting at which Aspose.Cells version was this property began to be supported?

Hi,


Yes, the property is recently included in the product. We recommend you kindly use v7.3.0 or greater versions of the product.

thank you.