Free Support Forum - aspose.com

No Gridlines

Hi Team

I am converting xlsx into Html using aspose.cells .net.

even though options.ExportGridlines is set as true …I failed to found gridline in generated html

please find document where i found this problem

demoExcel.zip (18.0 KB)

@kotharib2,

Thanks for the template file.

I tried your scenario/ case using the following sample code, it works fine. The output HTML has gridlines (displayed) of the sheet when viewing in the browser (e.g IE, Google chrome, etc.). I am using latest version/fix: Aspose.Cells for .NET v18.11.2 (please try it if you are not already using it):
Aspose.Cells18.11.2 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.11.2 For .Net4.0.Zip (4.7 MB)
e.g
Sample code:

Workbook wb = new Workbook("e:\\test2\\demoExcel.xlsx");

            HtmlSaveOptions options = new HtmlSaveOptions();

           options.ExportGridLines = true;

           wb.Save("e:\\test2\\out1demoExample.html", options);

The output HTML file is also attached for your reference.
files1.zip (20.2 KB)

Sorry I just wrongly stated my issue…

My issue is in html you will find gridlines but when you will try to reconvert back same html to xlsx you will fail to see gridlines in regenerated xlsx file

please find attached file for your example you will not see gridlines in sheet 1 and sheet 2

demoExcel.zip (91.0 KB)

@kotharib2,

Thanks for the template file.

Is your attached file is input file? If so, I noticed, the gridlines are not actually not there for the sheets when viewing it in MS Excel manually. So, when you convert it to HTML and reconvert it back to XLSX file format, gridlines will not be shown. See the screenshot for your reference:

And, if this is your output/final XLSX file, kindly do provide your input file and paste your sample code here, we will check it soon.

the file I attached recently is output file, which I got after converting original file into Html where I was able to see gridlines but when same html file I converted back into xlsx…I am not able to see gridlines.

this is the code samplet I am using…

  1. For Html Conversion

         Workbook xlsx = new xlsx(Root+"demoExcel.xlsx")
         HtmlSaveOptions options = new HtmlSaveOptions();
         options.Encoding = System.Text.Encoding.UTF8;
         options.ExportImagesAsBase64 = true;
         options.ExportGridLines = true;
         options.ExportSimilarBorderStyle = true;
         options.ExportBogusRowData = true;
         options.ExportHiddenWorksheet = true;
         xlsx.Save(Root+"demoExcel.html", options);    
    
  2. For Regeneration from Html to Xlsx

       Workbook xlsx_html = new Workbook(Root+demoExcel.html);
       xlsx_html.Save(Root+"regeneraed_deomExcel.xlsx")

@kotharib2,

Thanks for providing further details.

As requested earlier, kindly do provide your input file and output HTML file (you may zip the files in an archive), we will check it soon.

Hi @Amjad_Sahi

Please find all files attached…

  1. original file
  2. Html file generated from original
    3)Regenerated Xlsx from html file

demoExcel.zip (51.8 KB)

@kotharib2,

I suspect you are not using our latest version/fix (the links are already provide in one of our previous posts). I have tested your scenario/ case using the following sample code with your template (input) file and it works fine. I have attached the input Excel, output HTML and output/final XLSX files in the attached zipped archive for your reference. Please unzip the archive and check the files (by opening into MS Excel and in the browser), you will find everything is ok.
e.g
Sample code:

//For Html Conversion

            Workbook xlsx = new Workbook("e:\\test2\\demoExcel.xlsx");
            HtmlSaveOptions options = new HtmlSaveOptions();
            options.Encoding = System.Text.Encoding.UTF8;
            options.ExportImagesAsBase64 = true;
            options.ExportGridLines = true;
            options.ExportSimilarBorderStyle = true;
            options.ExportBogusRowData = true;
            options.ExportHiddenWorksheet = true;
            xlsx.Save("e:\\test2\\demoExcel1.html", options);    

            //For Regeneration from Html to Xlsx

            Workbook xlsx_html = new Workbook("e:\\test2\\demoExcel1.html");
            xlsx_html.Save("e:\\test2\\regeneraed_deomExcel1.xlsx");

files1.zip (58.3 KB)

Hi @Amjad_Sahi

Even I am using the same piece of code with aspose.cells 18.11 .Net version

I am not able to see gridlines in regenerated xlsx

please find attachemnts for youi to verify is there anything wrong with document?
I am facing this issue randomly…for some files I am getting gridlines for some I dont get.

demoExcel1_files.zip (58.2 KB)

@kotharib2,

Thanks for the sample file.

When I opened your output file into Ms Excel, I noticed the issue only for the first worksheet in the final/output XLSX file, other sheets are ok. We are very sorry but we are not sure why it is not working for the first worksheet (only) on your end. We recommend you to kindly try the attached version/fix: Aspose.Cells for .NET v18.11.3:
Aspose.Cells18.11.3 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.11.3 For .Net4.0.Zip (4.7 MB)
Aspose.Cells18.11.3 For .NetStandard20.Zip (3.8 MB)

To fix the issue, we got to reproduce the issue on our end first. So, we cannot log it. You can see my attachments where all worksheets are ok.