InsertField in Footer causes issue with Table Cell Merging (really!)

Hi

I have an issue that I have tracked down to the InsertField procedure

When I create a table with some merging, it works fine until InsertField is called elsewhere in the document generation - this causes the table to lose some of the merging previously formatted.

I have created some example code to demonstrate

// Create document and builder
Document Document = new Aspose.Words.Document();
DocumentBuilder DocumentBuilder = new DocumentBuilder(Document);

Table Table1 = DocumentBuilder.StartTable();

//********
// Row 1
//********

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.First;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(166.9));
DocumentBuilder.Font.Bold = true;
DocumentBuilder.Write("Trade Sign Off");
DocumentBuilder.Font.Bold = false;
DocumentBuilder.Write(" – All work order tasks have been completed as instructed and all documentation has been completed");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.First;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(60));
DocumentBuilder.Write("Name:");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.Previous;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(46.9));
DocumentBuilder.Write("");

// End Row
DocumentBuilder.EndRow();

//********
// Row 2
//********

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.Previous;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(166.9));
DocumentBuilder.Write("");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(60));
DocumentBuilder.Write("Signature By Me:");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(46.9));
DocumentBuilder.Write("Date:");

// End Row
DocumentBuilder.EndRow();

//********
// Row 3
//********

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.First;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(166.9));
DocumentBuilder.Font.Bold = true;
DocumentBuilder.Write("Supervisor Sign Off");
DocumentBuilder.Font.Bold = false;
DocumentBuilder.Write(" – Work Order has been completed to a satisfactory standard, regulatory W/Os have been completed and corrective W/Os have been generated for issues found.");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.First;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(60));
DocumentBuilder.Write("Name:");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.Previous;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(46.9));
DocumentBuilder.Write("");

// End Row
DocumentBuilder.EndRow();

//********
// Row 4
//********

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.Previous;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(166.9));
DocumentBuilder.Write("");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(60));
DocumentBuilder.Write("Signature:");

// Create cell
DocumentBuilder.InsertCell();
DocumentBuilder.CellFormat.VerticalMerge = CellMerge.None;
DocumentBuilder.CellFormat.HorizontalMerge = CellMerge.None;
DocumentBuilder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(ConvertUtil.MillimeterToPoint(46.9));
DocumentBuilder.Write("Date:");

// End Row
DocumentBuilder.EndRow();

// End Table
DocumentBuilder.EndTable();

DocumentBuilder.InsertField("Page");

If you take out the last line, you will have a correctly formatted table - with it in, it causes issues with the merging.

Any suggestions would be greatly appreciated!

Cheers

Adam

Hi Adam,

Thanks for your query. This is a known issue, please share in which format you are saving the document so that I will link this forum thread to the appropriate issue.


Hi Tahir


Thanks for the response. Our users will have the choice of Doc, Docx and RTF for output.

I did some further testing and found if I create the sections and footers before populating the document, it works for Doc, but still has the same problem for Docx

Thanks

A

Hi Adam,

Thanks for sharing the information. I have managed to reproduce the same problem at my end. I have logged this issue in our issue tracking system and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi, has this issue been solved in the meantime because I seem to be experiencing a similar problem with Aspose.Words for Java. Thanks.

Hi Toon,

Thanks for your request. I have verified the status of this issue from our issue tracking system. This issue is pending for analysis, after analysis we can share any ETA about this issue.

We apologies for your inconvenience.

The issues you have found earlier (filed as WORDSNET-6385) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.