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

Free Support Forum - aspose.com

Vertical Alignment in a table cell/row

Hello.


I talked to Sabir on your support and I was told there is no support for verical text alignment on the TextFrame in Aspose.Cells. I was hoping you could add support it, since Microsoft supports it, at least in Office 2007 (I don’t have access to any other versions).

Thanks for you help

Regards,
Stian

Hi Stian,

Thanks for your interest in Aspose.Slides.

Well, our conversation was regarding some older versions of Aspose.Slides. In the recent versions, we have margin properties associated with a TextFrame like MarginTop, MarginBottom, MarginLeft, MarginRight. Here is an example how to use these properties for text alignment purpose in a TextFrame.

Presentation pres = new Presentation();

Slide sld = pres.GetSlideByPosition(1);

Aspose.Slides.Table tbl= sld.Shapes.AddTable(50, 50, 3000, 1000, 3, 3);

Aspose.Slides.Cell cell= tbl.GetCell(0, 0);

TextFrame tf = cell.TextFrame;

tf.MarginTop = 0;

tf.Text = "Top";

pres.Write("pptTableAspose.ppt");

Hope this will be helpful.

Best Regards

Yes, I know about Margin, but my problem is getting the text bottom aligned. The height of the row/cells is variable based on how many columns, and what the text is in each column. This causes very high columns, with some texts being short. And the short texts will be aligned in the top with a big space under.


I will try to create a picture so I can show how it looks.

Thanks for your suggestion.

Regards,
Stian

Here you can see the problem I am facing. I have censored the text only. I want all the headers to be bottom aligned. “Deltager” and “Ligger…” looks very stupid up there.


Regards,
Stian

Hi Stian,

Thanks for your interest in Aspose.Slides.

Well, TextFrame object exposes AnchorText property, that can be used for vertical alignment. An example for this is as under:

Presentation pres = new Presentation();

Slide sld = pres.GetSlideByPosition(1);

Aspose.Slides.Table tbl= sld.Shapes.AddTable(50, 50, 3000, 1000,10, 40);

Aspose.Slides.Cell cell= tbl.GetCell(0, 0);

TextFrame tf = cell.TextFrame;

tf.Text = "Bottom";

tf.Paragraphs[0].Portions[0].FontHeight = 8;

tf.AnchorText = AnchorText.Bottom;

pres.Write("pptTableAspose.ppt");

Best Regards