0

HTML

<Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;FONT-WEIGHT: bold;'>Status: </Font>
<Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;'>REGISTERED 8 **&** 15, June 20, 2003</Font>
<Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;FONT-WEIGHT: bold;'>Int'l Class: </Font>
<Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;'> 25</Font>

Processed HTML by aspose property .HtmlString

**worksheet.Cells[rowTiled, columnTiled].HtmlString = __htmlString;**

<Font Style="FONT-WEIGHT: bold;FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;">Status: </Font>
<Font Style="FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;">REGISTERED 8 **&amp;** 15, June 20, 2003&lt;/Font&gt;
&lt;Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;FONT-WEIGHT: bold;'&gt;Int'l Class: </Font>
<Font Style="FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;"> 25</Font>

Issue with aspose .HtmlString property process character & to &amp; but it also convert some html tag < and> in encoded format. This formation create wrong string, that’s why I got HTML text in my Excel Sheet.

dertkw
  • 7,798
  • 5
  • 37
  • 45
Jack
  • 3
  • 2

1 Answers1

0

I am working as Social Media Developer at Aspose.

Well, you need to use "&amp ;" instead of "&" in your html string to use it with Aspose.Cells for .NET. I checked the following code with latest version and it works fine.

//instantiate workbook
Workbook wb = new Workbook();

//Get worksheet
Worksheet ws = wb.Worksheets[0];

//Get Cells
Aspose.Cells.Cells cell = ws.Cells;

//Set HTML String
cell[0, 0].HtmlString = "<Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;FONT-WEIGHT: bold;'>Status: </Font><Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;'>REGISTERED 8 &amp; 15, June 20, 2003</Font><Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;FONT-WEIGHT: bold;'>Int'l Class: </Font><Font Style='FONT-FAMILY: Arial;FONT-SIZE: 9pt;COLOR: #000000;TEXT-ALIGN: left;'> 25</Font>";

//Save Workbook
wb.Save("c:\\data\\outputhtmlstring.xlsx");
  • Thanks,i try same in my solution but some how it's not working ,but little bit change in my code for encoding string and issue resolved. – Jack Jun 16 '14 at 10:37