Free Support Forum - aspose.com

Alignment of a table using DocumentBuilder

I have a table that I am creating and would like the table to be centered on the page but it remains aligned left. Below is the code:
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Center
docBuilder.StartTable()
docBuilder.Font.Name = DocumentFont
docBuilder.Font.Size = DocumentFontSizeFoot
docBuilder.InsertCell()
docBuilder.CellFormat.Width = ConvertUtil.InchToPoint(2.5)
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Left
docBuilder.Write(“123456”)
docBuilder.InsertCell()
docBuilder.CellFormat.Width = ConvertUtil.InchToPoint(1.5)
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Center
docBuilder.InsertField(“PAGE”, “”)
docBuilder.InsertCell()
docBuilder.CellFormat.Width = ConvertUtil.InchToPoint(2.5)
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Right
docBuilder.Writeln(printDate)
docBuilder.EndRow()
docBuilder.InsertCell()
docBuilder.CellFormat.Width = ConvertUtil.InchToPoint(2.5)
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Center
docBuilder.Write(“Request: 123456”)
docBuilder.InsertCell()
docBuilder.CellFormat.Width = ConvertUtil.InchToPoint(1.5)
docBuilder.InsertCell()
docBuilder.CellFormat.Width = ConvertUtil.InchToPoint(2.5)
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Center
docBuilder.Writeln(“Action: 7890123”)
docBuilder.EndRow()
docBuilder.InsertCell()
docBuilder.CellFormat.Width = ConvertUtil.InchToPoint(6.5)
docBuilder.ParagraphFormat.Alignment = ParagraphAlignment.Center
docBuilder.Write(“This report is issued without acknowledgement of any liability or obligation.”)
docBuilder.EndRow()
docBuilder.EndTable()

This table is footer for the page, also. What am I doing wrong?

Alan F

You should use the DocumentBuilder.RowFormat.Alignment property to control the alignment of the table on the page.