Formated Text Area - Align Text

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v5)  /  Formated Text Area - Align Text

DynamicPDF CoreSuite for .NET (v5) Forum

 Aug 26 2009 6:49 AM
How do you justify text in a formated text area?
 Aug 26 2009 6:58 AM
Posted by a ceTe Software moderator
Hello,

You can set the alignment to the text using the FormattedTextAreaStyle object. You will have to use the TextAlign enumeration for setting this alignment. Below is a line of code for this.

   formattedArea.Style.Paragraph.Align = TextAlign.Justify;

Thanks,
ceTe Software Support Team.
 Aug 26 2009 7:40 AM
I have over 50 formated text areas in my document, if add formatedtextfield.Style.Paragraph.Align = TextAlign.Justify, all of them get justified.

Is there away around that?
 Aug 26 2009 7:42 AM
I only want specific fields to be justified.
 Aug 26 2009 7:53 AM
Posted by a ceTe Software moderator
Hello,

Setting this property to one FormattedTextArea will not affect the other formatted text areas. You have to set this to the specific formatted text area object for which you want to set the alignment.

    FormattedTextArea area = new FormattedTextArea(text, 100, 100, 100, 100, FontFamily.Helvetica, 20, true);
    //below line is for the "area" object alone.
    area.Style.Paragraph.Align = TextAlign.Justify;

You can also create the FormattedTextAreaStyle object for each formatted text area separately. You will have to use this style object in the constructor of the FormattedTextArea. Below is the code.

    FormattedTextAreaStyle style = new FormattedTextAreaStyle(FontFamily.Courier, 12, true);
    style.Paragraph.Align = TextAlign.Justify;
    FormattedTextArea area = new FormattedTextArea(text, 100, 100, 100, 100, style);

Thanks,
ceTe Software Support Team.
 Apr 01 2022 4:30 PM
I am doing exactly this, however, if I later update the STYLE it changes all of my formattedtext areas. For instance,  if I have some formatted text that is added to cell1 and the STYLE is set to left align at that time, then I later update the align to RIGHT on the style and add text to cell 2 all cells align RIGHT. 
 Apr 04 2022 9:32 AM
Posted by a ceTe Software moderator
Hi,

If you are adding multiple FormattedTextAreas and looking for different styles, then please try using and a new Style object for each FormattedTextArea and see it works for you.

If you continue facing an issue, then please send over following information to support@dynamicpdf.com so we can look into it further.

1. Simple code or an application which uses static data to recreate the behavior.
2. Output PDF.
3. Exact version and build number of DynamicPDF DLL file used in your application. You can find this information by right clicking on the DLL file>>Properties>>Details tab>>Product version. Take a screenshot of Details tab and send it over to us.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 7:39 AM.