Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with Text > Working with Multi-Line Text > Multi-Line Text Format Codes
Multiline Text Format Codes

Multiline text can be formatted in any text editor using special format codes.

Paragraph Format Codes

Format Code Description Example Render Result
\px Opening tag for paragraph format codes
\P New paragraph, all settings for a new paragraph defined by the previous \px tag are kept
Indent codes
i<value> First line indent \pxi1.5;
l<value> Hanging indent \pxl1.0;
r<value> Right indent \pxr2.5;
Paragraph alignment codes
ql Left align \pxql;
qc Center align \pxqc;
qr Right align \pxqr;
qj Justify \pxqj;
qd Distribute \pxqd;
Paragraph spacing codes
b<value> Before \pxb1.5;
Note: For illustrative purposes, the format in this example is applied to the first paragraph only.
a<value> After \pxa1.5;
Note: For illustrative purposes, the format in this example is applied to the first paragraph only.
Paragraph line spacing codes
sm<value> Multiply \pxsm1.5;
se<value> Exactly \pxse0.75;
sa<value> At least \pxsa0.5;
Tab codes
t<value> Tab with left alignment \pxt15,25;Lorem ipsum dolor\P\U+0009sit\U+0009amet
tc<value> Tab with center alignment \pxtc15,c25;Lorem ipsum dolor\P\U+0009sit\U+0009amet
tr<value> Tab with right alignment \pxtr15,r25;Lorem ipsum dolor\P\U+0009sit\U+0009amet
tD<decimal_symbol><value> Tab with decimal alignment \pxtD_15,D.25;Lorem ipsum dolor\Psit\U+00093_00\U+00095.00786\Pamet\U+000973_0\U+0009969.03

One unit of the values for indents, spaces, line spaces and tabulations is equal to the height of the text. Therefore, all values are expressed in the number for the text height. In the examples above, the text height is 2 mm, so tabbing by 15 units gives a value of 3 cm, etc.

Note: Initially there was a \p opening tag for paragraph format codes. It supported first line indent (i<value>), paragraph indent (l<value>) and tabulation (\t<value>, <value>). The \px tag is the opening tag for extended paragraph format codes that additionally supports right indent, paragraph space before and after, paragraph alignment and spacing. The extended format was introduced in version R27(ACAD20013) .dwg files. Starting from version R32(ACAD2018), \px is the standard opening tag for paragraph format codes.

Character Format Codes

Format code Description Example Render result
\O Overline start Lorem \Oipsum dolor sit\o amet
\o Overline end
\L Underline start Lorem \Lipsum dolor sit\l amet
\l Underline end
\K Strikethrough start Lorem \Kipsum dolor sit\k amet
\k Strikethrough end
\C<color_index>; Text color; color index can range from 0 to 255 Lorem \C1;ipsum \C2;dolor \C3;sit \C4;amet, \C5;consectetur \C6;adipiscing \C7;elit, \C100;sed do \C128;eiusmod \C150;tempor \C200;incididunt ut \C255;labore et dolore magna aliqua.
\F<filename>; Font name Lorem {\Fgdt|c204;l80} ipsum {\fTimes new roman|b1|i1|c204|p34;dolor}
\f<filename>{|b<bold>|i<italic>|c<codepage>|p<pitch>}; Font name and parameters
\H<value>; Text height, fixed drawing units Lorem \H.30;ipsum dolor sit\H.20; amet
\H<value>x; Text height, multiple of the current text height Lorem \H2x;ipsum dolor sit\H0.5x; amet
\S<text><stack_symbol><text>; Stacked text; stack symbol can be one of the following:
/ – fraction horizontal
# – fraction diagonal
^ – tolerance
~<decimal_sign> – tolerance with decimal alignment
1\S2/3; 1\S2#3; 1\S2^3; 1\S23.4~.5.67; abc\Sdef/ghi; abc\Sdef#ghi; abc\Sdef^ghi; abc\Sde_f~_g_hi;
\Q<angle>; Text oblique angle Lorem \Q30;ipsum dolor sit\Q amet
\Q Oblique angle end
\W<value>; Text width factor Lorem \W2;ipsum dolor sit\W1; amet
\A<value>; Text alignment; value can be one of the following:
0 – bottom
1 – center
2 – top
\A0;1\S2/3; \A1;1\S2/3; \A2;1\S2/3; \A0;abc\Sdef/ghi; \A1;abc\Sdef/ghi; \A2;abc\Sdef/ghi;
\T<value>; Character spacing factor; value can range from 0.75 to 4 Lorem \T2;ipsum dolor sit\T1; amet

Braces define the text area influenced by the code. Codes and braces can be nested up to 8 levels deep.

Character Insert Codes

Format code Description Example Render result
\~ Non-breaking space Lorem ipsum dolor sit amet, consectetur\~adipiscing\~elit, sed\~do\~eiusmod\~tempor\~incididunt ut labore et dolore magna aliqua.
\\ Backslash Lorem \\ipsum dolor sit\\ amet
\{...\} Open and close brackets Lorem \{ipsum dolor sit\} amet
\P New paragraph Lorem ipsum dolor sit amet, consectetur adipiscing elit,\Psed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
\N New column Lorem ipsum\Ndolor sit amet
\U+<character_code> Unicode character Lorem \U+003Cipsum dolor sit\U+003E amet
%%<character_code> Special character; character code can be one of the following:
c – diameter character
d – degree character
p – tolerance character (plusminus)
%%c %%d %%p

Backslash (\) is the escape character for special characters (backslash itself and braces), e.g. \\ = "\", \{ = "{", etc.

The gdt font contains a set of symbols used for designations in drawings. For more details, see Font Handling.

See Also

Working with Multi-Line Text

Font Handling

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.