Search code examples
asposeaspose.words

How can we add a table with 3 rows in footer using aspose.words in .Net


I'm using Aspose.words in .net API and getting in an issue to add a separate table in word footer using this tool. Can anyone expedite me to do this?


Solution

  • You can Insert a Table in Word footer with three cells using below piece of code:

               var doc = new Document();
    
                var builder = new DocumentBuilder(doc)
                {
                    PageSetup =
                    {
                        Orientation = Orientation.Portrait,
                        PaperSize = PaperSize.Letter
                    },
    
                };
            builder.MoveToHeaderFooter(Word.HeaderFooterType.FooterPrimary);
            builder.StartTable();
                builder.InsertCell();
                builder.CurrentParagraph.ParagraphFormat.Alignment = Word.ParagraphAlignment.Center;
                builder.Write("Cell 1");
    
    
                builder.InsertCell();
                builder.CurrentParagraph.ParagraphFormat.Alignment = Word.ParagraphAlignment.Center;
                builder.Write("Cell 2");
    
                builder.InsertCell();
                builder.CurrentParagraph.ParagraphFormat.Alignment = Word.ParagraphAlignment.Center;
                builder.Write("Cell 3");
    
            builder.EndTable();
            builder.MoveToDocumentEnd();