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

Free Support Forum - aspose.com

Adding HTML Rich Text inside the Cell in Excel spreadsheet in .NET

We tested the HTML Rich Text inside the Cell(demo: Adding HTML Rich Text inside the Cell), but we found some tags are not supported.the pictures below show rich text data:
image.png (55.9 KB)


<p style="box-sizing:content-box;color:#515967;font-family:'Segoe UI Light', Verdana, Tahoma, Arial;font-size:16px;background-color:#ffffff;"><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;">The following documents <span style="text-decoration:underline;"><strong>Contango Oil &amp; Gas Company</strong></span>&rsquo;s (<del>the Company or Contango</del>)&nbsp;</span><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;"><span style="box-sizing:content-box;">Entity Level process and controls.</span><span style="box-sizing:content-box;">&nbsp;&nbsp;</span><strong style="box-sizing:content-box;"><em style="box-sizing:content-box;">See the Company&rsquo;s other process narratives and flows for additional controls related to the COSO components for the control environment, information and communication, control activities and monitoring.</em></strong></span></p>
<p style="box-sizing:content-box;color:#515967;font-family:'Segoe UI Light', Verdana, Tahoma, Arial;font-size:16px;background-color:#ffffff;"><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;"><strong style="box-sizing:content-box;"><em style="box-sizing:content-box;"></em></strong></span><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:large;">Internal control is defined as a process</span><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;">, effected by an entity&rsquo;s board, management and other personnel, designed to provide reasonable assurance regarding the achievement of objectives in the following categories:</span></p>
<ul style="box-sizing:content-box;color:#515967;font-family:'Segoe UI Light', Verdana, Tahoma, Arial;font-size:16px;background-color:#ffffff;margin-top:0in;" type="disc">
<li style="box-sizing:content-box;"><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;">Effectiveness and efficiency of operations.</span></li>
<li style="box-sizing:content-box;"><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;">Reliability of financial reporting.</span></li>
<p><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;">Link:&nbsp;<a href="http://www.google.com" target="_blank">Google.Web</a><br />
<p><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;">Image: <img alt="" height="40" src="/UploadFiles/UploadImages/Client_9/videobg_201708181159140147.png" width="40" /></span></p>
<p><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;"></span><span style="font-family:Arial, Helvetica, sans-serif;font-size:small;">Paragraph</span><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;">:&nbsp;</span><span style="box-sizing:content-box;font-family:Arial, Helvetica, sans-serif;font-size:small;"></span></p>
<p style="text-align:left;">Left</p>
<p style="text-align:center;">Center</p>
<p style="text-align:right;">Right</p>
<p style="text-align:left;">BackGroundColor: <span style="background-color:#ff3300;">Red</span></p>

Excel Result:
image.png (45.9 KB)

We found some html tags can’t convert. For example:

  1. Strikethrough
  2. Add Link and image
  3. Format: h1 h2…
  4. Align Text: Center/Right
  5. Add Table

So if there is some simple HTML, Aspose.Cells can convert it into HTML Rich Text, is right? If it supported, how do we set up or download the correct file? Thanks .


Thanks for the source HTML and details.

I am afraid, Aspose.Cells does not support to parse all the HTML tags but mostly it follows MS Excel standards and specifications when reading or rendering HTML file format. So, if MS Excel can open the HTML file and display the contents fine into it, it should show the similar view. I have tested your scenario/case using the following sample code with the attached template HTML file ( I put the HTML contents in a file and save the HTML) using latest version/fix: Aspose.Cells for .NET v17.8 (please try it) to convert to XLSX file format and found certain issues. Could you retest it using latest version/fix v17.8 and provide some screenshots to highlight the issues (by encircling in red color). We will log appropriate tickets for each issue to be evaluated by our product team.
Sample code:

 Workbook workbook = new Workbook("e:\\test2\\test1.html", new HTMLLoadOptions(LoadFormat.Html));

files1.zip (8.7 KB)

Thank you.

Thank you for your reply.
We’re using the latest version of the nuget(vs2015) installation。
This is my code:

        Worksheet sheet = wb.Worksheets[0];
        //Access the "A1" cell in the sheet.
        Cell cell = sheet.Cells["A1"];
        cell.HtmlString = htmlTestCode;
        filePath = string.Concat(filePath, ".xlsx");
        //Save the Excel file.
        wb.Save(Server.MapPath(filePath), SaveFormat.Xlsx);

The above problem was discovered in cell, are there any other solutions in the ASPOSE? Thanks.


Thanks for the sample code segment.

I have logged a ticket with an id “CELLSNET-45599” for your issue. We will look into it if we could figure it out soon.

Once we have an update on it, we will let you know here.

Thank you.


We have no plan to support these tags in Cell.HtmlString.

Please directly open those html data as new Workbook, then copy range to your excepted position.