FitText class

Office 2013 and later

Defines the FitText Class. When the object is serialized out as xml, its qualified name is w:fitText.

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

public class FitText : OpenXmlLeafElement

[ISO/IEC 29500-1 1st Edition]

fitText (Manual Run Width)

This element specifies that the contents of this run shall not be automatically displayed based on the width of its contents, rather its contents shall be resized to fit the width specified by the val attribute. This expansion/contraction shall be performed by equally increasing/decreasing the size of each character in this run's contents when displayed.

If this element is omitted, then the contents of this run shall be displayed based on the size of its contents.

[Example: Consider a document with a run which must be displayed in exactly one-half inch of space, regardless of its contents. This constraint would be specified using the following WordprocessingML:

<w:r>
  <w:rPr>
    <w:fitText w:id="50" w:val="720" />
  </w:rPr>
  <w:t>This text must be displayed in one-half of an inch.</w:t>
</w:r>

The resulting run contents must be displayed in exactly 720 twentieths of a point (one half of an inch) when displayed in a document. end example]

Parent Elements

rPr (§17.3.1.29); rPr (§17.3.1.30); rPr (§17.5.2.28); rPr (§17.9.25); rPr (§17.7.9.1); rPr (§17.7.5.4); rPr (§17.3.2.28); rPr (§17.5.2.27); rPr (§17.7.6.2); rPr (§17.3.2.27)

Attributes

Description

id (Fit Text Run ID)

Specifies a unique ID which shall be used to link multiple contiguous runs containing fitText elements to each other to ensure that their contents are correctly merged into the specified width in the document.

This means that multiple runs which are broken apart due to differences in formatting can be identified as belonging to the same grouping in terms of fitText properties, although they are multiple runs of text in the WordprocessingML.

If the runs are not contiguous, then the id attribute is ignored, and the runs are not linked.

If this attribute is omitted, then this run has no id and shall not be linked with any other run in the parent paragraph.

[Example: Consider the following three runs in a document, which should be fit into exactly one inch at display time:

<w:r>
  <w:rPr>
    <w:fitText w:id="99" w:val="1440" /> 
  </w:rPr>
  <w:t>fit this into</w:t> 
</w:r>
<w:r>
  <w:rPr>
    <w:b/> 
    <w:fitText w:id="99" w:val="1440" /> 
   </w:rPr>
  <w:t>one</w:t> 
</w:r>
<w:r>
  <w:rPr>
    <w:fitText w:id="99" w:val="1440" /> 
   </w:rPr>
  <w:t>inch</w:t> 
</w:r>

Although there are three runs of content, all three regions must be combined into a single fit text region (e.g. they all fit into one inch, rather than one inch each) based on the identical value used in the id attribute for all three runs. end example]

The possible values for this attribute are defined by the ST_DecimalNumber simple type (§17.18.10).

val (Value)

This attribute specifies the exact width of space which this run shall be fit into when displayed in the document.

[Example: Consider a document with a run which must be displayed in exactly one-half inch of space, regardless of its contents. This constraint would be specified using the following WordprocessingML:

<w:r>
  <w:rPr>
    <w:fitText w:id="50" w:val="720" />
  </w:rPr>
  <w:t>This text must be displayed in one-half of an inch.</w:t>
</w:r>

The resulting run contents must be displayed in exactly 720 twentieths of a point (one half of an inch) when displayed in a document. end example]

The possible values for this attribute are defined by the ST_TwipsMeasure simple type (§22.9.2.14).

[Note: The W3C XML Schema definition of this element’s content model (CT_FitText) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: