File: vixmlconWorkingWithText.htm

package info (click to toggle)
office2003-schemas 1.0%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, forky, sid, trixie
  • size: 42,304 kB
  • sloc: javascript: 2,429; makefile: 29
file content (216 lines) | stat: -rw-r--r-- 14,188 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01086436"><META NAME="lcid" CONTENT="1033"><title>Working with a Shape's Text in DatadiagramML</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>Working with a Shape's Text in DatadiagramML</h1><p>Several groups of elements are involved in working with the text of a shape<nbsp />— 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.</p><p>The following table gives a brief description of these elements and their relationships.</p><table>
			<tr>
				<th>
					
						<b class="bterm">Element</b>
					
				</th>
				<th>
					<b class="bterm">Description</b>
				</th>
			</tr>
			<tr>
				<td>
					<code>&lt;Shape&gt;</code>
				</td>
				<td>
					<p>Opening tag for the <b class="bterm">Shape</b> element.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;Text&gt;</code>
				</td>
				<td>
					<p>Opening tag for the shape's text.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;cp/&gt;</code>
				</td>
				<td>
					<p>Marks character runs.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;pp/&gt;</code>
				</td>
				<td>
					<p>Marks paragraph runs.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;tp/&gt;</code>
				</td>
				<td>
					<p>Marks tab runs.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;fld/&gt;</code>
				</td>
				<td>
					<p>Marks <b class="bterm">Field</b> position.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;/Text&gt;</code>
				</td>
				<td>
					<p>Closing tag for the shape's text.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;Char&gt;</code>
				</td>
				<td>
					<p>Contains character properties.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;Para&gt;</code>
				</td>
				<td>
					<p>Contains paragraph properties.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;Tabs&gt;</code>
				</td>
				<td>
					<p>Contains tab properties.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;Field&gt;</code>
				</td>
				<td>
					<p>Contains the shape's text field properties.</p>
				</td>
			</tr>
			<tr>
				<td>
					<code>&lt;/Shape&gt;</code>
				</td>
				<td>
					<p>Closing tag for the <b class="bterm">Shape</b> element.</p>
				</td>
			</tr>
		</table><p>For example, consider the following shape. It has text that consists of two character runs, one in bold and the other in italic.</p><p>
				<img border="0" src="../img/XML_04.gif" alt="Text that consists of two character runs, one in bold and the other in italic">
			</p><p>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:
				</p><p><img border="0" src="../img/XML_007_ZA01108249.gif" alt="Character rows from the ShapeSheet."></p><p>
			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:</p><pre><code>&lt;Char IX='0'&gt;
      &lt;Font&gt;4&lt;/Font&gt;
      &lt;Color&gt;0&lt;/Color&gt;
      &lt;Style&gt;17&lt;/Style&gt;
      &lt;Case&gt;0&lt;/Case&gt;
      &lt;Pos&gt;0&lt;/Pos&gt;
      &lt;FontScale&gt;1&lt;/FontScale&gt;
      &lt;Size Unit='PT'&gt;0.1666666666666667&lt;/Size&gt;
      &lt;DblUnderline&gt;0&lt;/DblUnderline&gt;
      &lt;Overline&gt;0&lt;/Overline&gt;
      &lt;Strikethru&gt;0&lt;/Strikethru&gt;
      &lt;Highlight&gt;0&lt;/Highlight&gt;
      &lt;DoubleStrikethrough&gt;0&lt;/DoubleStrikethrough&gt;
      &lt;RTLText&gt;0&lt;/RTLText&gt;
      &lt;UseVertical&gt;0&lt;/UseVertical&gt;
      &lt;Letterspace&gt;0&lt;/Letterspace&gt;
      &lt;ColorTrans&gt;0&lt;/ColorTrans&gt;
      &lt;AsianFont&gt;0&lt;/AsianFont&gt;
      &lt;ComplexScriptFont&gt;0&lt;/ComplexScriptFont&gt;
      &lt;LocalizeFont&gt;0&lt;/LocalizeFont&gt;
      &lt;ComplexScriptSize&gt;-1&lt;/ComplexScriptSize&gt;
      &lt;LangID&gt;1033&lt;/LangID&gt;
&lt;/Char&gt;
&lt;Char IX='1'&gt;
      &lt;Font&gt;4&lt;/Font&gt;
      &lt;Color&gt;0&lt;/Color&gt;
      &lt;Style&gt;34&lt;/Style&gt;
      &lt;Case&gt;0&lt;/Case&gt;
      &lt;Pos&gt;0&lt;/Pos&gt;
      &lt;FontScale&gt;1&lt;/FontScale&gt;
      &lt;Size Unit='PT'&gt;0.1666666666666667&lt;/Size&gt;
      &lt;DblUnderline&gt;0&lt;/DblUnderline&gt;
      &lt;Overline&gt;0&lt;/Overline&gt;
      &lt;Strikethru&gt;0&lt;/Strikethru&gt;
      &lt;Highlight&gt;0&lt;/Highlight&gt;
      &lt;DoubleStrikethrough&gt;0&lt;/DoubleStrikethrough&gt;
      &lt;RTLText&gt;0&lt;/RTLText&gt;
      &lt;UseVertical&gt;0&lt;/UseVertical&gt;
      &lt;Letterspace&gt;0&lt;/Letterspace&gt;
      &lt;ColorTrans&gt;0&lt;/ColorTrans&gt;
      &lt;AsianFont&gt;0&lt;/AsianFont&gt;
      &lt;ComplexScriptFont&gt;0&lt;/ComplexScriptFont&gt;
      &lt;LocalizeFont&gt;0&lt;/LocalizeFont&gt;
      &lt;ComplexScriptSize&gt;-1&lt;/ComplexScriptSize&gt;
      &lt;LangID&gt;1033&lt;/LangID&gt;
&lt;/Char&gt;
</code></pre><p><b>Note</b>  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."</p><p>The two <b class="bterm">Char</b> elements represent the two Character rows. Each has an <b class="bterm">IX</b> attribute describing the relative order of the rows. Each <b class="bterm">Char</b> element contains child elements that correspond to the cells viewed in the ShapeSheet window.</p><p>The <b class="bterm">Shape</b> element also contains an element called <b class="bterm">Text</b>, which contains the characters of the text and special elements (<b class="bterm">cp</b>, <b class="bterm">pp</b>, <b class="bterm">tp</b>, and <b class="bterm">fld</b>) that mark the end of one run and the beginning of the next. The <b class="bterm">Text</b> element is somewhat unusual because it contains both data (the text characters) and child elements (<b class="bterm">cp</b>, <b class="bterm">pp</b>, and so on).</p><p>The <b class="bterm">Text</b> element that describes the text on the preceding shape follows:</p><pre><code>&lt;Text&gt;&lt;cp IX='0'/&gt;Bold &lt;cp IX='1'/&gt;Italic&lt;/Text&gt;
</code></pre><p>The <code>&lt;cp IX='0'&gt;</code> tag indicates that the character properties from the first <b class="bterm">Char</b> element (<code>&lt;Char IX='0'&gt;</code>) are to be applied to the text that follows. The <code>&lt;cp IX='1'/&gt;</code> tag indicates that the preceding character run (<code>&lt;Char IX='0'&gt;</code>) has ended and the run attributed to <code>&lt;Char IX='1'&gt;</code> has begun.</p>
				<p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Inheritance for text elements</a></p>
				<div id="ExpCol" class="collapsed" border="0">
					<p>Inheritance for text elements follows the standard inheritance rules. Text row elements (<b class="bterm">Char</b>, <b class="bterm">Para</b>, <b class="bterm">Tabs</b> and <b class="bterm">Field</b>) need to contain child elements only for elements whose values are different from their inherited value. For example, the statement <code>&lt;Char IX='0'&gt;&lt;Color&gt;4&lt;/Color&lt;/Char&gt;</code> is sufficient to specify that a <b class="bterm">Char</b> element should have blue text; the remaining element values will automatically be inherited.
						</p><p><b>Note</b>  Microsoft® Office Visio® writes out all values<nbsp />— inherited or not<nbsp />— when it saves a DatadiagramML file.</p>
					
					<p>The following special cases apply:</p><p><ul>
							<li>If the text row elements are in a master or a non-instance shape (a shape that is not an instance of a master), the values are inherited from the shape's text style, that is, the ID of the <b class="bterm">StyleSheet</b> that is referenced in the shape's <b class="bterm">TextStyle</b> attribute. If the shape does not contain a <b class="bterm">TextStyle</b> attribute, the values are inherited from the default document style.</li>
							<li>If the text row elements are in an instance shape (a shape that is an instance of a master), the values are inherited from the corresponding row in the master. If a corresponding row does not exist, values are inherited from the first row in the master. (An instance of a master that has a <b class="bterm">TextStyle</b> attribute inherits text properties from the style instead of the master.)</li>
						</ul>
					</p>
				</div>
			
				<p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Loading untrusted text</a></p>
				<div id="ExpCol" class="collapsed" border="0">
					<p>When Visio loads text from an XML file that is created or edited outside of Visio (an untrusted file), the first thing it does is <i>normalize</i> the text data, that is, it fills in, adds, or reorders missing elements and removes unused elements.</p>
					<p>Following are some of the ways in which Visio normalizes untrusted text data in a VDX file at load time.</p>
					<ul><li>When Visio emits a DatadiagramML file, all <b class="bterm">cp</b>, <b class="bterm">pp</b>, <b class="bterm">tp</b>, and <b class="bterm">fld</b> elements in the <b class="bterm">Text</b> element have <b class="bterm">IX</b> values that are sequential. In other words, a <code>&lt;cp IX ='0'/&gt;</code> tag always precedes a <code>&lt;cp IX ='1'/&gt;</code> tag, and so on.</li><li>If Visio encounters run markers that are out of order when it reads a DatadiagramML file, it inserts duplicates of the text run rows as needed. For example, say Visio reads the following file:<pre><code>&lt;Char IX='0'&gt; &lt;Style&gt; 0 &lt;/Style&gt; &lt;/Char&gt;
&lt;Char IX='1'&gt; &lt;Style&gt; 1 &lt;/Style&gt; &lt;/Char&gt;

&lt;Para IX='0'&gt; &lt;HorzAlign&gt; 0 &lt;/HorzAlign&gt; &lt;/Char&gt;
&lt;Para IX='1'&gt; &lt;HorzAlign&gt; 1 &lt;/HorzAlign&gt; &lt;/Char&gt;

&lt;Text&gt;&lt;cp IX='0'/&gt;&lt;pp IX='0'/&gt;The quick &lt;cp IX='1'/&gt;brown fox 
&lt;pp IX='1'/&gt;jumped &lt;cp IX='0'/&gt;over the lazy dog.&lt;/Text&gt;
</code></pre><p>The code describes a text block that contains three character runs and two paragraph property runs. There is a single paragraph break after the word "fox." The block would be rendered like this:</p><p>
						<img border="0" src="../img/XML_05.gif" alt="The quick brown fox jumped over the lazy dog. This text block contains three character runs and two paragraph property runs.">
					</p><p>In the preceding example, the <b class="bterm">Char</b> row 0 is referenced twice (<code>&lt;cp IX ='0'/&gt;</code>). Visio normalizes this by creating a third <b class="bterm">Char</b> row (<code>&lt;Char IX='2'&gt;</code>), which is identical to <b class="bterm">Char</b> row 0.</p><p>When the file is resaved, it contains the third <b class="bterm">Char</b> row and an additional <b class="bterm">cp</b> element marking the third character run, which is demonstrated as follows. In addition, the XML file will contain all the child elements (<b class="bterm">Font</b>, <b class="bterm">Size</b>, <b class="bterm">FontScale</b>, and so on) for all the <b class="bterm">Char</b> and <b class="bterm">Para</b> elements.</p><pre><code>&lt;Char IX='0'&gt;...&lt;Style&gt; 0 &lt;/Style&gt;...&lt;/Char&gt;
&lt;Char IX='1'&gt;...&lt;Style&gt; 1 &lt;/Style&gt;...&lt;/Char&gt;
&lt;Char IX='2'&gt;...&lt;Style&gt; 0 &lt;/Style&gt;...&lt;/Char&gt;

&lt;Para IX='0'&gt;...&lt;HorzAlign&gt; 0 &lt;/HorzAlign&gt;...&lt;/Char&gt;
&lt;Para IX='1'&gt;...&lt;HorzAlign&gt; 1 &lt;/HorzAlign&gt;...&lt;/Char&gt;

&lt;Text&gt;&lt;cp IX ='0'/&gt;&lt;pp IX='0'&gt;The quick &lt;cp IX ='1'/&gt;brown fox
&lt;pp IX ='1'/&gt;jumped &lt;cp IX ='2'/&gt;over the lazy dog.&lt;/Text&gt;
</code></pre></li><li><p>Although it is not an error to omit the marker for the first run, it is recommended that you include it. Visio always emits the initial marker element when the DatadiagramML data is round-tripped.</p></li><li><p>Paragraph run markers (<code>&lt;pp IX='1'&gt;</code>) and tab run markers (<code>&lt;tp IX='1'&gt;</code>) are valid only at the beginning of a paragraph. If such a marker is encountered in the middle of a paragraph, it is ignored. A new line is required before each <b class="bterm">pp</b> and <b class="bterm">tp</b> element.</p></li><li><p>Visio normalizes untrusted text data when it is loaded into the application. This means that Visio performs further processing<nbsp />— for example, local overrides or local deletions<nbsp />— on the normalized data. When you are editing or generating your own DatadiagramML files, you'll get better performance results if you try to mimic the XML that Visio generates.</p></li></ul>
					
					
					
					
					
					
					
					
					
					
					
				</div>
			<center><a href="XMLSchemaCopyright_HV01147162.htm">&copy;2003-2004 Microsoft Corporation. All rights reserved.</a>  

Permission to copy, display and distribute this document is available at: <a 

href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&amp;CTT=11&amp;Origin=HV011232471033" 

target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>