Show AllShow All

Working with a Shape's Text in DatadiagramML

Several groups of elements are involved in working with the text of a shape— the elements that describe characteristics of the text, those elements that describe the beginning and end of text runs, and an element that contains the text itself.

The following table gives a brief description of these elements and their relationships.

Element Description
<Shape>

Opening tag for the Shape element.

<Text>

Opening tag for the shape's text.

<cp/>

Marks character runs.

<pp/>

Marks paragraph runs.

<tp/>

Marks tab runs.

<fld/>

Marks Field position.

</Text>

Closing tag for the shape's text.

<Char>

Contains character properties.

<Para>

Contains paragraph properties.

<Tabs>

Contains tab properties.

<Field>

Contains the shape's text field properties.

</Shape>

Closing tag for the Shape element.

For example, consider the following shape. It has text that consists of two character runs, one in bold and the other in italic.

Text that consists of two character runs, one in bold and the other in italic

The portion of the shape's sheet that describes character text runs is called the Character section. The Character rows for this shape as viewed in the ShapeSheet window are as follows:

Character rows from the ShapeSheet.

Note that the column on the left indicates the length of each run, 4 characters and 7 characters, respectively. The only cells that vary between the two rows are the Style cell values. The Style cell determines if the run is bold, italic, or another style. The XML code for these rows follows:

<Char IX='0'>
      <Font>4</Font>
      <Color>0</Color>
      <Style>17</Style>
      <Case>0</Case>
      <Pos>0</Pos>
      <FontScale>1</FontScale>
      <Size Unit='PT'>0.1666666666666667</Size>
      <DblUnderline>0</DblUnderline>
      <Overline>0</Overline>
      <Strikethru>0</Strikethru>
      <Highlight>0</Highlight>
      <DoubleStrikethrough>0</DoubleStrikethrough>
      <RTLText>0</RTLText>
      <UseVertical>0</UseVertical>
      <Letterspace>0</Letterspace>
      <ColorTrans>0</ColorTrans>
      <AsianFont>0</AsianFont>
      <ComplexScriptFont>0</ComplexScriptFont>
      <LocalizeFont>0</LocalizeFont>
      <ComplexScriptSize>-1</ComplexScriptSize>
      <LangID>1033</LangID>
</Char>
<Char IX='1'>
      <Font>4</Font>
      <Color>0</Color>
      <Style>34</Style>
      <Case>0</Case>
      <Pos>0</Pos>
      <FontScale>1</FontScale>
      <Size Unit='PT'>0.1666666666666667</Size>
      <DblUnderline>0</DblUnderline>
      <Overline>0</Overline>
      <Strikethru>0</Strikethru>
      <Highlight>0</Highlight>
      <DoubleStrikethrough>0</DoubleStrikethrough>
      <RTLText>0</RTLText>
      <UseVertical>0</UseVertical>
      <Letterspace>0</Letterspace>
      <ColorTrans>0</ColorTrans>
      <AsianFont>0</AsianFont>
      <ComplexScriptFont>0</ComplexScriptFont>
      <LocalizeFont>0</LocalizeFont>
      <ComplexScriptSize>-1</ComplexScriptSize>
      <LangID>1033</LangID>
</Char>

Note  Although the size of the text is 12 points, the internal unit for points is inches. So the point size of "12" is represented in inches as "0.16666666666667."

The two Char elements represent the two Character rows. Each has an IX attribute describing the relative order of the rows. Each Char element contains child elements that correspond to the cells viewed in the ShapeSheet window.

The Shape element also contains an element called Text, which contains the characters of the text and special elements (cp, pp, tp, and fld) that mark the end of one run and the beginning of the next. The Text element is somewhat unusual because it contains both data (the text characters) and child elements (cp, pp, and so on).

The Text element that describes the text on the preceding shape follows:

<Text><cp IX='0'/>Bold <cp IX='1'/>Italic</Text>

The <cp IX='0'> tag indicates that the character properties from the first Char element (<Char IX='0'>) are to be applied to the text that follows. The <cp IX='1'/> tag indicates that the preceding character run (<Char IX='0'>) has ended and the run attributed to <Char IX='1'> has begun.

ShowInheritance for text elements

ShowLoading untrusted text

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp