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

Free Support Forum - aspose.com

Vertical alignment of text in table cells

I am working with the PPTX version of the component and cant seem to figure out how to vertically align the text in a table cell (and textbox). Any help would be appreciated…

Hi Dmitri,

I have observed the requirements shared by you. Please use the following sample code to serve the purpose. Please share if I may help you further in this regard.

//Instantiate PresentationEx
PresentationEx pres = new PresentationEx();

//Get the first slide
SlideEx sld = pres.Slides[0];

//Define columns with widths and rows with heights
double[] dblCols = { 250,150,50 };
double[] dblRows = { 150,130,30,30,30 };

//Add table shape to slide
int idx = sld.Shapes.AddTable(100, 50, dblCols, dblRows);
TableEx tbl = (TableEx)sld.Shapes[idx];

tbl[0, 0].TextFrame.Text = “top”;
tbl[0, 0].TextVerticalType = TextVerticalTypeEx.Vertical;
tbl[0, 0].TextAnchorType = TextAnchorTypeEx.Center;
//Write the presentation to disk
pres.Write(“d:\Aspose Data\TextBox.pptx”);

Many Thanks,