Free Support Forum - aspose.com

Disappearing table borders in the HTML file

Hi,

I have generated word document that has contents in a table. table has a single line border. everything is perfect in the generated document. i face problem when i save the document as a web page filtered, as .htm file. suddenly border disappears for certain tables when i re-open the html file. any help would be highly appreciated. please find the HTML output pasted at the end of the word document.

Thanks & Regards,

Dowjones.

Sorry, I cannot reproduce the problem saving attached document as an HTML file. All table borders seem to be ok in the resulting HTML. Please attach the file that will allow me to reproduce the problem.

Regards,

Hi,

I have attached one word document with this post. please save the document as a .htm (web page filtered) file. close the saved .htm file and then re open it. you can see some of the table borders getting disappeared.

Thanks & Regards,

Dowjones.

The document itself is okay, this seems to be an HTML or browser hitch. Just make the middle outer cell a bit wider and the problem disappears. I’m attching the document that is exported properly.

Hi,

The document you gave seem to be correct. i m not clear about the "middle outer cell" that you are talking about.which cell are you talking about? and how to make it wider programmatically?

your suggestion would be of great help to us.

Thanks & Regards,

Dowjones.

Sorry for being unclear. By "middle outer cell" I meant the cell without borders that contains several inner tables with yellow headers. I've investigated the problem deeper and figured out that borders occasionally disappear when changing the width of the browser window so that table widths get changed too. So to overcome the issue, you could probably force table widths to remain constant. This might be performed programmatically by making the inner tables wider than the containing cell. Here's the code for this particular document:

doc.FirstSection.Body.Tables[1].FirstRow.Cells[1].CellFormat.Width = 400;

foreach (Table table in doc.FirstSection.Body.Tables[1].FirstRow.Cells[1].Tables)

table.FirstRow.FirstCell.CellFormat.Width = 500;

Let me remind you, though, that this is a browser rendering issue. Aspose.Words produces correct HTML for this document and the only cause of the problem is that this particular HTML is shown improperly when resizing browser window.

Hi,

The middle outer cell with yellow headers you are mentioning is nothing but a paragraph. we have defined a BG color for the current para. we tried your suggestion, but couldnt able to get what we want. i have attached the code,word document and the html file generated.

Please look where we go wrong in coding.your suggestion would be of great help to us.

Thanks & Regards,

Dowjones.

Find ShowCell.doc in the attached zip. The red bordered cell is the "middle outer cell" I mentioned above and it's however a table cell, not a paragraph. The green bordered table cells contained in it should be programmatically made wider than the container. I've applied the provided code to your document and then converted it to HTML using Aspose.Words. The result is TestMissedBorder Out.html - it seems to be correct, no borders disappear. However, if you do the same utilizing MS Word, the produced document does contain the problem. This is yet another evidence that Aspose.Words has nothing to do with the issue and this is a browser bug or hitch.

Please understand us correctly, the HTML produced by Aspose.Words is completely valid. We've been trying to help you to overcome the browser rendering issue; however, it is out of our responsibility as this is not the bug of our component. So if nothing helps, you should try to find a solution yourself. The easiest way is to restructure the document I think; maybe use other ways to position the document contents instead of nested tables.

Hi,

Thanks a lot for your suggestion. I understand that aspose words produce correct html output. My problem is only with saving the word doc produced as html file. I will try to solve this problem by making the "middle outer cell" wider than its container.

Thanks & Regards,

Dowjones.