First cell content is wrapped to link with name printArea

Hi Aspose,
I selected table in the middle of sheet. I get table from Aspose with first cell in first line wrapped to link
with name=“printArea”. No matter which source I used.
Expectations: There should be no link.

<td colspan="4" class="pwc-excel-3e8338af-326a-428a-b527-cefa6cb77be2-x29" width="276" style="mso-ignore:colspan;"><a name="Print_Area"><span style="font-size:11pt;color:#44546A;font-weight:700;text-decoration:none;text-line-through:none;font-family:&quot;Calibri&quot;;">Organic Growth Analysis - COMBINED</span></a></td>

printArea_Aspose.zip (206.8 KB)

@ottap,

Thanks for the template file.

Could you please also share your sample code (runnable) that your are using to render to HTML from Excel range of cells, we will check it soon. By the way, when you perform the same task in MS Excel manually to render to HTML (Web page), do you see this issue?

Hello,

I am attaching our example source code. I have tested it also only with one cell with the same result. You can find there in the file “output-html.html” and the result looks like this:

<a name="Print_Area">test</a>
example.zip (2.3 MB)

@ottap,

Thanks for the sample with resource file(s).

Please notice, I am able to reproduce the issue as you mentioned by using your your template file. I found the first cell content is always wrapped to link with name “Print_Area”, we can confirm the issue when viewing the source of the generated HTML document. I have logged a ticket with an id “CELLSNET-51110” for your issue. We will look into it soon.

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

@ottap

Because you set print area(worksheet.PageSetup.PrintArea) to A1, so the output will be <a name="Print_Area">test</a>.

If you manually set print area in Excel and then manually save it to html, you will get the same result.

Dear Aspose,
tried once more with different file and providing sample with unwanted behavior.

There is no printable area when exported by Excel but there Printable Area when exported by Aspose.

Our intent is to extract just particular cellRange.
And that is the reason we are using:
worksheet.PageSetup.PrintArea = range.Address;

unfortunately due to extra a tag we have some styling issues.

Thanks for the help.
Best Regards
Pavel

PS:
Bug-60068-PrintArea.zip (2.4 MB)
Bug-60068-PrintArea.png (94.9 KB)

@ottap,

Thanks for the samples.

After an initial test using MS Excel, you are right as I noticed MS Excel behaves differently. I used your Excel file and then set the printable area to “B2:C4” for the second sheet. Now I save the selected sheet as “Web page”. I found there is no Print_Area (hyperlink) name defined. I have logged it with your existing ticket and reopened the issue again. We will investigate your issue further and get back to you soon.

@ottap

Please use the API HtmlSaveOptions.ExportArea to set area to export, instead of setting PrintArea, code:

Workbook wb = new Workbook("Sample.xlsx");

//wb.Worksheets["s2"].PageSetup.PrintArea = "B2:C4";

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
...
htmlSaveOptions.ExportActiveWorksheetOnly = true;
htmlSaveOptions.ExportPrintAreaOnly = true;
htmlSaveOptions.ExportArea = CellArea.CreateCellArea("B2", "C4");
...

wb.Save("output.html", htmlSaveOptions);