Parsing HTML H1 tag in Aspose Cells

The issues you have found earlier (filed as CELLSNET-47759) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

@ahsaniqbalsidiqui, @Amjad_Sahi

I have tested below HTML strings with latest version(20.12.0). Below HTML string is not working as expected in Excel and PDF files. Please check from your end and update me.

<h1>Test note for Aspose Cells Walk-through.</h1> - Not working

<h1>Test note for <u>Aspose Cells</u> Walk-through.</h1> - Working Fine(If I add unterline text formatting, at that time h1 tag is working)

@SenthilRG27,
I have tried this issue using the latest version but can observe that <h1> tag is properly rendered.
output_23A.pdf (12.8 KB)
output_23B.pdf (19.9 KB)
output_23B.xlsx.zip (5.9 KB)
output_23A.xlsx.zip (5.9 KB)

If you still find issue, please share your output files and images identifying the issue.

@ahsaniqbalsidiqui,

I am setting font size style for the cell, which is rendering HTML string. Please refer below code. If HTML string doesn’t contain any styles like underline, italic or bold, at that time h1 tag is not rendering properly. If HTML string contains any styles like underline, italic or bold, at that time h1 tag is rendering properly. I have attached sample Excel sheet and project for your reference.

Workbook workbook = new Workbook();
// Access first worksheet
 Worksheet worksheet = workbook.Worksheets[0];
 // Put some value in cell C2
 Cell cell = worksheet.Cells["C2"];
 cell.HtmlString = "<h1>This is XLSX format generated by Aspose.Cells API.<h1>";
 Style style = workbook.CreateStyle();
 style.Font.Size = 11;
 cell.SetStyle(style); // Not working
 cell = worksheet.Cells["C4"];
 cell.HtmlString = "<h1>This is XLSX format generated by <u>Aspose.Cells API</u>.<h1>";
 style = workbook.CreateStyle();
 style.Font.Size = 11;
 cell.SetStyle(style); // Working fine
 MemoryStream ms = new MemoryStream();
 workbook.Save(ms, SaveFormat.Xlsx);
 ms.Seek(0, SeekOrigin.Begin);
 byte[] buffer = new byte[ms.Length];
 buffer = ms.ToArray();
 Response.Clear();
 Response.ContentType = "application/vnd.ms-excel";
 Response.Headers.Add("Content-Disposition", "attachment; filename=myfile.xlsx");
 Response.Body.Write(buffer);

SampleFile
Aspose.Cells.Sample.zip (5.9 MB)
.zip (6.8 KB)

@SenthilRG27,
Thank you for sharing the sample code. We will analyze it and share our feedback soon.

@SenthilRG27,
We have observed the issue where H1 tag is not rendered without additional tags like underline, bold or italic. This issue is logged as:
CELLSNETCORE-93 - H1 tag not rendered without additional tags like underline, italic or bold

@ahsaniqbalsidiqui,

Thank you. Please update me once the issue got resolved.

@SenthilRG27,
Please remove the following codes:

Style style = workbook.CreateStyle();
style.Font.Size = 11;
cell.SetStyle(style); // Not working

Now Cell.SetStyle only update the style of the cell (C2) and it does not update the font of the rich formatted text(C4).

Aspose.Cells will try to update the font of the rich formatted text when calling Cell.SetStyle() method as MS Excel.
So if the above codes are called, all H1 tag will be removed.

@SenthilRG27,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@Amjad_Sahi,

Thank you.

@SenthilRG27,

Please try our latest version/fix: Aspose.Cells for .NET v20.12.1 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.12.1 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells20.12.1 For .Net4.0.Zip (5.5 MB)
Aspose.Cells20.12.1 For .NetStandard20.Zip (5.4 MB)

@Amjad_Sahi,

I have tried with latest Aspose Cells version (v20.12.1). Still the issue exists.

Workbook workbook = new Workbook();
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Put some value in cell C4
Cell cell = worksheet.Cells["C2"];
cell.HtmlString = "<h1>This is XLSX format generated by Aspose.Cells API.<h1>";
Style style = workbook.CreateStyle();
style.Font.Size = 11;
cell.SetStyle(style);
cell = worksheet.Cells["C4"];
cell.HtmlString = "<h1>This is XLSX format generated by <u>Aspose.Cells API</u>.<h1>";
style = workbook.CreateStyle();
style.Font.Size = 11;
cell.SetStyle(style);
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.Xlsx);

@SenthilRG27,

We already provided the reason in one of our previous post:

In short, you cannot update the style (via Style object) to an existing richly formatted text (you have already specified h1 tag) of the cell. So, you should not use Style object to increase or decrease font size of the cell.

@Amjad_Sahi,

I have verified the changes. This looks good. Please update me once the above Aspose Cells version available in Nuget Package Manager.

@SenthilRG27,
Thanks for the feedback. We will let you know once it will be published.

@ahsaniqbalsidiqui, @Amjad_Sahi,

Any updates on latest Aspose Cells version release (v20.12.1)?

@SenthilRG27,

Hopefully, it will be published (Nuget repos./Downloads section) before the end of next week or so. The date is not final as releases are published once ready. You will be notified here once the next official release (Aspose.Cells for .NET v21.1) is published (on Nuget repos./Downloads section).

The issues you have found earlier (filed as CELLSNETCORE-93) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

@Amjad_Sahi,

I have tested my HTML strings with latest Aspose Cells v21.1. My only concern is with below HTML string. It is not rendering properly.

<ul><li><strong><em><s><u>Aspose Cells Test</u></s></em></strong></li></ul>

@SenthilRG27,

I guess you are talking about missing bullet for the formatted text/data in the output XLSX file but we already told you as:
“If we open following string in Browser, a bullet is there but if I open it in MS Excel, there is no bullet displayed similar to Aspose.Cells. Hence it does not seem to be an issue with Aspose.Cells”.
<ul><li><strong><em><s><u>Aspose Cells Test</u></s></em></strong></li></ul>"

If you still think Aspose.Cells does not mimic MS Excel’s behavior, kindly share your expected XLSX file here, we will check it soon.

PS. please zip the XLSX file prior attaching here.