Hello,
I am trying to create a document with a table displaying some data and a table of contents. The table of data has a few rows where all the cells are merged.
I have found when calling the UpdateFields method to update the table of contents the merged cells in my data table are now only one cell wide rather than the full width of the table.
Is there a way around this?
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.CurrentParagraph.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Write(“Heading”);
builder.StartTable();
builder.InsertCell();
builder.CurrentParagraph.ParagraphFormat.StyleIdentifier = StyleIdentifier.BodyText;
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
builder.Write(“Data Table”);
builder.InsertCell();
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.Previous;
builder.EndRow();
builder.InsertCell();
builder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.None;
builder.Write(“Cell 1”);
builder.InsertCell();
builder.Write(“Cell 2”);
builder.EndRow();
builder.EndTable();
builder.MoveToDocumentStart();
builder.Write(“Contents:”);
builder.InsertBreak(BreakType.LineBreak);
builder.InsertTableOfContents("\o “1-3” \h \z \u");
doc.UpdateFields();
builder.InsertBreak(BreakType.PageBreak);
doc.UpdateFields();
doc.Save(this.Response, “Summary.doc”, ContentDisposition.Attachment, null);
Response.End();
Thanks
Hi
Stephen,
Thanks for your inquiry.
While using the latest version of Aspose.Words i.e. 11.6.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-6806. Your request has also been linked to this issue and you will be notified as soon as it is resolved.
Sorry for the inconvenience.
Best Regards,
The issues you have found earlier (filed as WORDSNET-6806) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.