Vertical Align Middle

In looking through your documentation it seems the only vertical alignment options are top and bottom. Could you add middle alignment as well? Make sure it can be set at both the Text and Segment level. How long would this take?

Thanks!

Dan

Dear Dan,

Vertical center alignment is supported in table cell and it is at Text level. We don't support it at page level. And I don't think it is reasonable to support Vertical alignment at segment level.

Tommy,

I don't see any way to set vertical center alignment at the Text level. Please provide the code.

Thanks!

Dan

Hi,

Please refer to the following code.

Pdf pdf1 = new Pdf();

Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();

sec1.Paragraphs.Add(table1);

table1.ColumnWidths = “100 4cm”;

Aspose.Pdf.Row row1 = table1.Rows.Add();

row1.FixedRowHeight = 20.0F;

Aspose.Pdf.Cell cell1Row1 = row1.Cells.Add("Center ");

cell1Row1.VerticalAlignment = VerticalAlignmentType.Center;

cell1Row1.ColumnsSpan = 2;

cell1Row1.Border = new BorderInfo((int)BorderSide.All, 0.5F);

Aspose.Pdf.Row row2 = table1.Rows.Add();

row2.FixedRowHeight = 20.0F;

Aspose.Pdf.Cell cell1Row2 = row2.Cells.Add("Bottom ");

cell1Row2.Border = new BorderInfo((int)BorderSide.All, 0.5F);

cell1Row2.VerticalAlignment = VerticalAlignmentType.Bottom;

Aspose.Pdf.Cell cell2Row2 = row2.Cells.Add("Top ");

cell2Row2.Border = new BorderInfo((int)BorderSide.All, 0.5F, new Aspose.Pdf.Color(“Red”));

cell2Row2.VerticalAlignment = VerticalAlignmentType.Top;

pdf1.Save(“D:/AsposeTest/Alignment.pdf”);

Hope it helps!

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,

I didn’t knew what problem arises with the Forum Post. Please refer to the following code:

Pdf pdf1 = new Pdf();

Section sec1 = pdf1.Sections.Add();

Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();

sec1.Paragraphs.Add(table1);

table1.ColumnWidths = “100 4cm”;

Aspose.Pdf.Row row1 = table1.Rows.Add();

row1.FixedRowHeight = 20.0F;

Aspose.Pdf.Cell cell1Row1 = row1.Cells.Add("Center ");

cell1Row1.VerticalAlignment = VerticalAlignmentType.Center;

cell1Row1.ColumnsSpan = 2;

cell1Row1.Border = new BorderInfo((int)BorderSide.All, 0.5F);

Aspose.Pdf.Row row2 = table1.Rows.Add();

row2.FixedRowHeight = 20.0F;

Aspose.Pdf.Cell cell1Row2 = row2.Cells.Add("Bottom ");

cell1Row2.Border = new BorderInfo((int)BorderSide.All, 0.5F);

cell1Row2.VerticalAlignment = VerticalAlignmentType.Bottom;

Aspose.Pdf.Cell cell2Row2 = row2.Cells.Add("Top ");

cell2Row2.Border = new BorderInfo((int)BorderSide.All, 0.5F, new Aspose.Pdf.Color(“Red”));

cell2Row2.VerticalAlignment = VerticalAlignmentType.Top;

pdf1.Save(“D:/AsposeTest/Alignment.pdf”);

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Yes, that shows how to vertical align center on a table cell, but I was asking about a Text object.

Please provide code on how to assign vertical align center on a Text object, since Tommy said that Text level has this ability.

Thanks!

Dan

Dear Dan,

Sorry for not making it clear. What I mean is when setting vertical alignment in table cell, the whole text inside the table cell will be centered. Vertical center for segment is not supported. We ONLY support vertical alignment inside table cell currently.