Hi,
I have same the problem in getting the text to change the text alignment to center and I am using Aspose.Pdf version 8.8.0.0.
Here is my code.
using (Aspose.Pdf.Document Doc = new Aspose.Pdf.Document(input))
{
foreach (Aspose.Pdf.Page page in Doc.Pages)
{
Aspose.Pdf.FloatingBox fb = new Aspose.Pdf.FloatingBox();
fb.Top = 520.0f;
//this was the version 1
//fb.Left = 331.0f;
fb.Left = -40.0f;
fb.Width = 510.23f;
fb.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;
fb.VerticalAlignment = Aspose.Pdf.VerticalAlignment.Top;
fb.IsNeedRepeating = false;
//fb.IsExtraContentClip = true;
fb.IsKeptWithNext = false;
Aspose.Pdf.Table table = new Aspose.Pdf.Table();
//Set default cell border using BorderInfo object
//table.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);
table.Border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1F, Aspose.Pdf.Color.Red);
//Set with column widths of the table
table.ColumnWidths = "100%";
Aspose.Pdf.Row row = new Row();
row.DefaultCellPadding = new MarginInfo(12,3,12,3);
Aspose.Pdf.Text.TextState textState = new Aspose.Pdf.Text.TextState();
textState.HorizontalAlignment = HorizontalAlignment.Center;
row.DefaultCellTextState = textState;
Aspose.Pdf.Cell cell = new Aspose.Pdf.Cell();
float fontSize = 12.0f;
cell.Alignment = HorizontalAlignment.Center;
HorizontalAlignment alignment = Aspose.Pdf.HorizontalAlignment.Center;
Aspose.Pdf.Text.TextFragment txtFragment = new Aspose.Pdf.Text.TextFragment();
txtFragment.TextState.HorizontalAlignment = alignment;
// Add a text segment to text together
Aspose.Pdf.Text.TextSegment segmentText = new Aspose.Pdf.Text.TextSegment();
Aspose.Pdf.Text.Font font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");
font.IsEmbedded = true;
segmentText.TextState.Font = font;
segmentText.TextState.FontSize = fontSize;
segmentText.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Regular;
segmentText.TextState.ForegroundColor = Aspose.Pdf.Color.Red;
segmentText.TextState.HorizontalAlignment = alignment;
segmentText.Text = "The Govt estimates that the Federal carbon tax and green energy schemes add about $100 a year to a typical 6.5MWh household bill.";
txtFragment.Segments.Add(segmentText);
cell.Paragraphs.Add(txtFragment);
row.Cells.Add(cell);
table.Rows.Add(row);
fb.Paragraphs.Add(table);
page.Paragraphs.Add(fb);
}
Doc.Save(stream);v