Footer end mismatch with huge hyperlink's

Whenever I create a RTF file using aspose word I am finding a footer mismatch in the document generated. Please check the below for further reference.


1) Create a document object and section

Document doc = new Document();
Section sec = new Section(doc);
doc.Sections.Add(sec);

2) Create appropriate table

Table currentTable = new Table(doc);
Row row1 = new Row(doc);
row1.RowFormat.Height = 40;
currentTable.AppendChild(row1);
Cell cell = new Cell(doc);
cell.CellFormat.PreferredWidth = PreferredWidth.FromPoints(505);
cell.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
row1.AppendChild(cell);

3) Now creating appropriate footer

HeaderFooter footer = new HeaderFooter(doc, HeaderFooterType.FooterPrimary);
sec.HeadersFooters.Add(footer);
footer.AppendChild(currentTable);
sec.AppendChild(new Body(doc));
Paragraph paragraph = new Paragraph(doc);
paragraph.ParagraphFormat.Alignment = ParagraphAlignment.Center;
paragraph.ParagraphFormat.Style.Font.Size = 9;
paragraph.ParagraphFormat.Style.Font.Name = “Arial”;
FieldHyperlink hyperLink = (FieldHyperlink)paragraph.AppendField(Aspose.Words.Fields.FieldType.FieldHyperlink, false);
hyperLink.Result = “Google”;
hyperLink.Update();
paragraph.Runs[paragraph.Runs.Count - 1].Font.Color = System.Drawing.Color.Blue;
cell.AppendChild(paragraph);

4) Applying appropriate table design

currentTable.ClearBorders();
currentTable.AllowAutoFit = true;
currentTable.PreferredWidth = PreferredWidth.FromPoints(505);
currentTable.Alignment = TableAlignment.Center;
currentTable.SetShading(TextureIndex.TextureSolid, System.Drawing.Color.FromArgb(191, 191, 191), System.Drawing.Color.Empty);
currentTable.SetBorders(LineStyle.None, 0, System.Drawing.Color.White);

5) Creating body content

Paragraph para1 = new Paragraph(doc);
para1.AppendChild(new Run(doc, “Body text”));
sec.Body.AppendChild(para1);

6) Now save it

doc.Save(“sample.rtf”, SaveFormat.RTF);

Now open the document using notepad (if possible notepad++), check for “{\footer” in respective RTF instruction generated for the document. Check for the end of footer (it should be closed before the body section, but it wont. In some cases it is missing).

Hi Sridhar,


Thanks for your inquiry. I have attached an output rtf document here for your reference. This was generated using Aspose.Words for .NET 16.1.0. Do you see the same problem with this document? Please open this with Notepad++, create comparison screenshot which highlights/explains the problematic areas in this rtf and attach it here for our reference. We will investigate the issue further on our end and provide you more information.

Best regards,