Save as HTML and display grid lines

Is there a way to have grid lines in html when saving in that format?
I tried this code, but it doesn’t work:

foreach (Worksheet sheet in workbook.Worksheets)
{
sheet.IsGridlinesVisible = true;
}

var opt = new HtmlSaveOptions();
opt.SaveFormat = SaveFormat.Html;
workbook.Save(outfile, opt);

Hi,

I think, you should set the border of the cells and then save your workbook in html format.

Please see the following reference article:
Adding Borders to Cells

Hi,


I can find the issue as you have mentioned by using a simple file for Html conversion. I have logged a ticket with an id: CELLSNET-40303. We will look into it soon.

Thank you.
Hi,

After further investigation, we looked into your issue and found that, MS Excel saved html file with grid lines (shown) can't be seen in IE either, could you provide a sample html file with grid lines enabled and post it here. We will check it soon.

Thank you.

I don’t have a sample. I was just evaluating your product, and I was asking myself if it is possible with your library. My need is to have a tool to convert an excel file to html in order to represent it in a browser “as is”, with grid lines and heading rows and columns.

Thank you very much for your very quick replies

Hi,

Please follow the advice I have given in the above post.
https://forum.aspose.com/t/118432

thank you very much for your suggestion.

However this kind of solution is not so good for my situation. I have an
excel coming as input, and I have to display it as HTML in a browser in
a read only way, but represented as it was open in excel, with cell grids and
column and row headers.

With your suggetion I should make a copy of original sheet and transform it just to put borders where missing (I can’t place always a black border everywhere, because if the original sheet has some cells with border I have to respect this setting)

Hi,

I guess, Aspose.Cells for GridDesktop which is also a part of Aspose.Cells Family Product will better suit your requirements.

You will be able to open your Excel file using Aspose.Cells for GridDesktop with gridlines.

Please see
Working with GridWeb > Opening an MS Excel File