Superscript and Subscript issue when both are in same excel cell

Hi,

I am using Aspose V5.0.0.0 for creating worksheets with some values in Excel where value is having all combination of HTML tags in it. For example we need to create an excel sheet with a cell having HTML local formatting tags in its cell value. The code sample we are using is like below :

string value = @"SuperScript
SubScript


(a+b)2H2O


(a+b)2
This is a seperation line
H2O


H2OCO2


(a+b)2(a-b)2


Superscript - A2

Subscript -A2

";

cell.HtmlString = System.Web.HttpUtility.HtmlDecode(value);

Once after populating the cell value, we could see the difference in formatting when we compare the same the HTML value in any browser. We need to match the formatting exactly as it appears in the browser, in the newly created excel sheet.

Hi,

Please see the code below. I have tested it with latest version: Aspose.Cells
for .NET v6.0.0.6


Please see the output file generated by the code and the screenshot. It is working fine.

C#


Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

Cell cell = worksheet.Cells[“B2”];
cell.HtmlString = “Superscript and Subscript”;

worksheet.Cells.SetColumnWidth(1, 30);
worksheet.Cells.SetRowHeight(1, 30);

workbook.Save(@“F:\Shak-Data-RW\Downloads\SuperscriptAndSubscript.xlsx”, SaveFormat.Xlsx);


Screenshot: