Borders are not shown when export from html to excel (XLSX)


#1

Hi,

I am trying to export a htm document that has borders and the resulted Excel (XLSX) is not showing borders and please advice. I have provided the sample htm below and attached the excel outputAspose Border Sample.JPG (16.2 KB)
. We have OEM license of this product with latest dll version 17.12.0.0. Let me know if you require more details and I am using
below code for conversion,

public byte[] GetExcelBytes(string fileName, ref string status)
{
try
{
HTMLLoadOptions options = new HTMLLoadOptions(LoadFormat.Html);
options.SupportDivTag = true;
options.DeleteRedundantSpaces = true;
Workbook book = new Workbook(fileName, options);
using (MemoryStream stream = new MemoryStream())
{
Worksheet workSheet = book.Worksheets[0];
workSheet.AutoFitColumns();
workSheet.AutoFitRows();
book.Save(stream, new OoxmlSaveOptions(SaveFormat.Xlsx));
return stream.ToArray();
}
}
catch (Exception ex)
{
status = "Exception: " + ex.ToString() + "\n Inner Exception: " + ex.InnerException + "\n Stacktrace: " + ex.StackTrace;
return null;
}
}

HTML content,

MARS - Omnibus Reconciliation .XSLText { mso-number-format: \@; }
 
Omnibus Reconciliation
 
User : Karen Miller Date : 12/20/2017 10:46:43 PM
ID Profile Product Status TA Process Date Purchases Redemptions Exchange In Exchange Out Others Difference

-Soma


#2

@helpdesk

Thanks for using Aspose APIs.

Please provide us your HTML file which you are converting to XLSX file. We will look into this issue and help you asap.

Please also download and try the most recent version and see if it makes any difference and resolves your issue.


#3

Hi Shakeel,

Thanks for your reply, I am not able to upload HTML file due to your upload restrictions and attached the sample as pdf file and hope it will help you to create a HTML file. Aspose Border Sample.pdf (42.0 KB). I tried on most recent version Aspose.cells for .NET 17.12 and having issues reported. I copied the same HTML below and it’s getting transformed.

MARS - Omnibus Reconciliation .XSLText { mso-number-format: \@; }
 
Omnibus Reconciliation
 
User : Karen Miller Date : 12/20/2017 10:46:43 PM
ID Profile Product Status TA Process Date Purchases Redemptions Exchange In Exchange Out Others Difference

-Soma


#5

@helpdesk

Thanks for using Aspose APIs.

We generated Excel file from your HTML using Microsoft Excel and Aspose.Cells and it looks same. Please download them and check them. If you find any issue, then let us know, we will look into it further.

Download Link:
Sample Input HTML, Excel Output and Aspose.Cells Output Excel Files.zip (14.8 KB)

Please download and use the most recent version. It should fix your issue.

C#

Workbook wb = new Workbook(dirPath + "sample.html");
wb.Save("ByCells.xlsx");

#6

Hi Shakeel,

Thanks for your reply. I couldn’t figure out the problem with the htm file you are using but actually it should show the border across the table as shown in the attachment and please download the attachment see if you can see the borders. Let me know if you require more details.

AsposeCellsSample.zip (23.7 KB)

-Soma


#7

@helpdesk

Thanks for using Aspose APIs.

We were able to observe the borders issue. We have logged this issue in our database for investigation and for a fix. Once, the issue is resolved or we have some other news for you, we will update you asap.

This issue has been logged as

  • CELLSNET-45819 - Borders are not shown when export from Html to Excel

#8

Hi Shakeel,

Thanks for your reply and please let us know when you resolve the issue.

-Soma


#9

@helpdesk

Sure, once we will have some fix for you or any other update relating to this issue, we will let you know about it in this topic.


#10

@helpdesk

Thanks for using Aspose APIs.

Please download and try the following fix and let us know your feedback.


#11

The issues you have found earlier (filed as CELLSNET-45819) have been fixed in this Aspose.Cells for .NET 18.1 update.

Please also check the following article:


#12

Hi Shakeel,

Thanks for your prompt reply, this issue is fixed now and working as expected. I test this on 18.1 version, working fine and thanks for fixing this.

-Soma


#13

@helpdesk

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.