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

Free Support Forum - aspose.com

Vertical align of text in a textbox

Hi Aspose team,

I have a question about the alignment of text in a textbox.
Is it possible to set the vertical align of the text to center or middle inside a shape textbox (shape) linke in this example document?
vertical_align.zip (11.4 KB)

Thanks for your help.

Best Regards,

Paul Bachmann

@B4chi,

We have logged your requirement in our issue tracking system. The ID of this issue is WORDSNET-15849. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for your inconvenience.

Ok thanks for your fast reply.

@B4chi,

You can even meet this requirement by using the following code:

Document doc = new Document("vertical_align.docx");
 
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
 
// Calculate middle margin.
shape.TextBox.InternalMarginTop = (shape.TextBox.InternalMarginTop + shape.TextBox.InternalMarginBottom) / 2;
 
doc.Save("out.docx");

Please let us know if this solution is acceptable for you?

A post was split to a new topic: Vertical align of text in a textbox LibreOffice