We have just made some formatting enhancements to our tables and figures when extracted to Word using Aspose.Word. These were developed on Word 2003 and we were very pleased with the results. However during testing the documents crash Word 2000. I am using the latest Aspose Word hotfix (2.3)
I have attached an example project that builds a document which crashes in Word 2000. It uses an xml source file and renders it’s contents to Word. This xml source file is included in the attached zip. The code may appear over complex, as it’s been cut and pasted from a much larger web project. Hopefully you can still step through it and see what is happening. My suspicion is that some of the table formatting is causing the issue.
Hopefully you will be able to compile and run the attached project and be in a much better position to diagnose what is causing the crash than I am!
This is a live project for us, so a prompt response would be greatly appreciated.
This code set’s the top and bottom border of a table cell to a single line, but of different widths. In the example I attached, it occurs in the WriteTableFigureTitle and WriteTableFigureDataSource methods in the WordBase.cs class.
I do not see that different border width causes the document to crash in Word
200 in my code. It is more likely that you don’t call EndRow and EndTable
appropriately. I have not checked this in your code yet.Here is my code
that creates valid documents, see comments below about no shading for
cells.
builder.InsertCell();
Border topBorder = builder.CellFormat.Borders[BorderType.Top];
topBorder.LineWidth = 2;
topBorder.Color = System.Drawing.Color.FromArgb(205,212,226);
topBorder.LineStyle = LineStyle.Single;
Border bottomBorder = builder.CellFormat.Borders[BorderType.Bottom];
bottomBorder.LineWidth = 1;
bottomBorder.Color = System.Drawing.Color.FromArgb(205,212,226);
bottomBorder.LineStyle = LineStyle.Single;
//If you want to reset cell shading to none this is the easiest to do.
builder.CellFormat.Shading.ClearFormatting();
//This is how you can reset cell shading to none "manually".
//Have a look in MS Word, Format / Borders and Shading / Shading.
//Both background and foreground colors are set to automatic color (or no fill)
//and texture is set to clear.
builder.CellFormat.Shading.Texture = TextureIndex.TextureNone;
// WordUtil.AutoColor is not in the public API yet, but it is defined like this:
//internal static readonly Color AutoColor = Color.FromArgb(0x00000000);
builder.CellFormat.Shading.BackgroundPatternColor = WordUtil.AutoColor;
builder.CellFormat.Shading.ForegroundPatternColor = WordUtil.AutoColor;
//Don’t forget to end the row and the table.
builder.EndRow();
builder.EndTable();