HtmlString basic formatting

Using v8.5.2.0

I have the following html:

(See attachments)



And as you can see in the attached images:

- the entire cell is yellow, not just the word “Evidence”

- the word “Three” is not in italics

- there are no bullet points



Is this a bug, or are there some workarounds I need to do to pre-format the text to make it work?



Your help would be appreciated.

Hi,

Thanks for your posting and using Aspose.Cells.

Please provide us your HTML markup as you have shown in the image so that we could load it at our end and investigate this issue further. We will look into it and update you asap. In case it is a bug, we will log it in our database for a fix.

My Evidence is as follows:

  • One
  • Two
  • Three
  • Formatted item

Hi,

Thanks for your posting and using Aspose.Cells.

The html you will be provided will not be contained in a single cell but it will span multiple cells. I verified it by copying the following html into a notepad and then opened it in Microsoft Excel 2010.


My Evidence is as follows:



  • One

  • Two

  • Three

  • Formatted item




Then I saved it in xlsx format using Microsoft Excel and attach it for your reference. Since this html spans many cells, so a single cell.HtmlString will not work.

I have also converted the above html into xlsx format using Aspose.Cells with the following code. However it is not quite similar to the one displayed by Microsoft Excel.

As a workaround you can create your formatted text in some cell in Microsoft Excel and then save it in HTML format and then extract that HMTL and use it in Cell.HtmlString property. It should fulfill your needs.

C#

string filePath = @“F:\Shak-Data-RW\Downloads\a.html”;


HTMLLoadOptions opts = new HTMLLoadOptions(LoadFormat.Html);


Workbook workbook = new Workbook(filePath, opts);

workbook.Save(filePath + “.out.xlsx”);

This html is coming from user input, and it needs to be in one cell - it can’t span multiple cells.

Is this still possible? I can strip p tags and replace with br tags if I need to.

Hi,

Thanks for posting and using Aspose.Cells.

I have looked into this issue and found that bullets are not supported inside the Excel cells. I will suggest you first create your formatting inside the Excel cell manually using Microsoft Excel and the save the workbook in HTML format using Save As… menu command and then check the HTML generated by Microsoft Excel and use that generated HTML (also modify it as per your needs) to generate your excel files with desired formatting programmatically using Aspose.Cells APIs.