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?
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.
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. 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?
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.