I can open this document just fine in MS Word 2003
but not in any earlier versions. If I scroll to page 5 of the document
(where there is a doc.builder generated table) MS Word shuts
down. I tired the below solution (setting the first cell in each
row) as it appears on other postings in the forums but still no luck.
CellFormat.HorizontalMerge = CellMerge.None;
Please see the attached doc. It causes MS Word 2002 or earlier
to crash if you scroll to page 5 of the document. The table on page 5
is a table within a table. See the attached source code as well. The
table in question is started on line 574 of the source code.
oophs. I attached the wrong source code. The correct source code is attached to this posting. The previous source code submitted was the work around I had for this error. It does NOT generate a table within a table. The code that generates the table within a table (on page 5 of the generated report document) is the code which causes Word 2000 to crash. I basically start a table, insert a cell, insert an image, insert a cell, start another table, insert several cells (each with an image), end both tables and thats it. Please let me know what you find ASAP. I have clients waiting on this.
Sorry for delay. We have problem on a web site that prevents downloading of the attached code file.
Can you please repeat the attachment, maybe in zip this time.
Here it is.
The issue looks complicated. Please give me one more day to look for a workaround.
Anyway, I will log this issue in our defect base. We will try to make a permanent fix in the next release which will be published in the end of August.
A workaround would be nice. Something that simulates having two tables next to each other on a page.
Ok, it seems that I have found the cause of the problem.
When you set DocumentBuilder.RowFormat.Borders.LineWidth to values greater than 0, you need also to set DocumentBuilder.RowFormat.Borders.LineStyle explicitly to value other than LineStyle.None. Otherwise, the versions of MS Word earlier than MS 2003 crash on openning the document.
I was not able to reproduce your document generation completely as I don't have enough data for this. But what generation I was able to reproduce stopped failing after I have added
builder.RowFormat.Borders.LineStyle = LineStyle.Single;
builder.RowFormat.Borders.LineWidth = 1;
Hope that will help. Please inform me of the results.
This problem is logged to our defect base as issue #1133. We will try to prevent generation of documents that cannot be opened in MS Word 2000, 2002 due to incorrect setting of Borders properties in user code.
Great! That worked. I set all border widths to zero and LineStyles to none. I substituted dashes for the top and bottom table borders. The result is definitely acceptable. Thanks. The quick response is greatly appreciated.
The issue is fixed in Aspose.Words 4.0. Now if you set line width of a border to greater than zero while line style is none, line style is automatically set to single line.