We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

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);

2) Create appropriate table

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

3) Now creating appropriate footer

HeaderFooter footer = new HeaderFooter(doc, HeaderFooterType.FooterPrimary);
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.Address = “http://www.google.com/doodles/rukmini-devis-112th-birthday”;
hyperLink.Result = “Google”;
paragraph.Runs[paragraph.Runs.Count - 1].Font.Color = System.Drawing.Color.Blue;

4) Applying appropriate table design

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”));

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,