We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Cells API doesn't return cell content with all formatting

Hi there, we are using the latest Aspose.Cells .NET version. Although your API is able to reliably return the contents from a cell, as well as very simple formatting, it is unable to return all of a single cell’s content with all formatting intact. We have many worksheets for example where a single cell contains multiple instances of bold, underline and italic text. In addition, many of our worksheets contain single cells where multiple font colours or multiple background colours reside.

Would it be possible for your API to return all of the content plus styling in some sort of comprehensive fashion, perhaps in HTML format or something similar where formatting could be preserved through the use of HTML markup?

Thanks
Shan

Hi Shan,

Well, I think you may try Cell.HtmlString attribute if it fits your need.
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/aspose.cells.cell.htmlstring.html


Thank you.

Hi Amjad, thank you for your follow up. Yep, have tried it, the issue is that although your API does return formatted content, the API does not return the content formatted consistently with how it is actually captured in a single cell. Take a single cell for example, where you format 10 words differently within that single cell. Perhaps some text in the cell is green, some red, some blue and some black. Then perhaps some text is underlined, some is bolded, etc. In those scenarios where there are multiple formats applied within a single cell, the Cell.HtmlString API that you refer to does not return the content with all of the multiple formats.

Let me know if you’re not able to reproduce this, I’d be happy to send you a private sample.

Thanks
Shan

Hi Shan,

Thank you for considering Aspose.

Well, I tested your scenario a bit with the attached latest version and it works fine (using Cell.HtmlString). Please try the attached version and if you still face any problem, please share your template file here and we will check it soon.

Thank You & Best Regards,

Hi Nausherwan, I tried your attached component and wow, what a major difference. The HtmlString property is working very well. It looks like it is properly maintaining most if not all of the cell formatting. It’s a marked improvement from version 4.8.1.0.

Thank you very much,
Shan