Centering Text in a FloatingBox

Is there anyway to center the text in the center of a FloatingBox?

In XML example below I'd like "Hello" to be in the center of the yellow box.

<?xml version="1.0" encoding="utf-8" ?>



Hello



Thanks,

Chris

Dear Chris,

You can add Alignment="Center" into the Text tag to make it at the center horizontally. Vertical alignment is not supported. We will support for it in the new version.

Has this been added. If so, where?

Hello Steve,

Thanks for considering Aspose.

I'm pleased to inform you that in latest version of Aspose.Pdf v4.0.0.0 a feature to set the Vertical Alignment of text is supported. Please try using the following XML file in which both Horizontal and Vertical Alignment of text is set to Center. The resultant PDF is also in attachment, please take a look.

[XML]

<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns="Aspose.Pdf">
<Section>
<FloatingBox BackgroundColor="Yellow" Width="1.5inch" Height="80" Left="150" Top="100" TextVerticalAlignment="Center">
<Text Alignment="Center"><Segment>Hello</Segment>
</FloatingBox>
</Section>
</Pdf>

FYI, In order to set the Horizontal alignment of text, you need to use the Alignment property of TextInfo class. And you can use TextVerticalAlignment property of FloatingBox class to specify the Vertical Alignment of text in a FloatingBox.