Free Support Forum - aspose.com

Rotated Text

Hi,

is there any way to add a rotated text to a table cell?

I tried to create a shape (TEXT_BOX) with text and 90° rotation, but only the box was rotated, not the contained text.

Thanks,
Tom

Hi Tom,

Thanks for your request. I am afraid this is an expected behavior. In Ms Word you cannot rotate text inside textbox. However, you can specify orientation of text. For instance see the following code:

Document doc = new Document();

Shape textbox = new Shape(doc, ShapeType.TextBox);

textbox.Width = 100;

textbox.Height = 100;

textbox.TextBox.LayoutFlow = LayoutFlow.BottomToTop;

Paragraph par = new Paragraph(doc);

textbox.AppendChild(par);

par.AppendChild(new Run(doc, "This is test content"));

doc.FirstSection.Body.FirstParagraph.AppendChild(textbox);

doc.Save(@"Test001\out.doc");

Hope this helps.

Best regards,

Thanks, works like a charm