added samples
[windows-sources.git] / sdk / samples / WPFSamples / DocumentStructure / readme.htm
blob0a5f40758755fc208ff057f2ce6df9c95eabbdf6
1 <html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" /><META NAME="save" CONTENT="history" /><title xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Document Structure Sample</title><META NAME="Description" CONTENT="&#xD;&#xA; The Document Structure sample illustrates the difference between an XPS document with and without a structure, and how to add a document structure to an XPS document without one. The sample provides two example XPS documents: &quot; ..."></META><META NAME="MS.LOCALE" CONTENT="en-us" /><style>
2 body
3 {font-family:Verdana;font-size:medium;}
4 div#mainSection, div#header
5 {font-size:70%;width: 100%;}
6 div#mainBody
7 {font-size:90%;}
8 div#mainSection div table
9 {font-size: 100%;text-align: left;}
10 span#nsrTitle
11 {color:#003399;font-size:90%;font-weight:600;}
12 div#header
13 {background-color:#D4DFFF;}
14 .heading
15 {font-size:120%;color:#003399;}
16 .subHeading
17 {font-size:100%;margin-bottom:4;}
19 {margin-top:-2;margin-bottom:3;}
21 {margin-top:10;margin-bottom:5;}
22 div.tableSection p
23 {margin-top:1;margin-bottom:4;}
24 div#mainSection table th
25 {background-color:#EFEFF7;color:#000066;text-align:left;}
26 div#mainSection table td
27 {background-color:#F7F7FF;}
28 div#mainSection table
29 {margin-top:5px;margin-bottom: px;}
30 </style></head><body><div id="header"><table width="100%" id="topTable"></table></div><div id="mainSection"><div id="mainBody"><br /><font color="DarkGray">[This readme is a partial copy of the sample's topic in the SDK documentation.]</font><br /><font color="DarkGray" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"></font><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"></p><div class="introduction"><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
31 The <i>Document Structure</i> sample illustrates the difference between an XPS document with and without a structure, and how to add a document structure to an XPS document without one. The sample provides two example XPS documents: "Spec_withoutStructure.xps" and "Spec_withStructure.xps". When viewed in a <span sdata="cer" target="T:System.Windows.Controls.DocumentViewer">DocumentViewer</span> control, both XPS files provide exactly the same visual layout, quality, and print output - both documents fully comply with the open XML Paper Specification (XPS). Cut and paste operations for each document, however, is quite different. Build the sample and perform the following steps:
32 </p><ol xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p>
33 Click <b>File</b> | <b>Open...</b>, select the file "Spec_withoutStructure.xps", and then click <b>OK</b>. Within the "Spec_withoutStructure" document shown in the <span sdata="cer" target="T:System.Windows.Controls.DocumentViewer">DocumentViewer</span> control select a part of Table 1-1 and paste it into a blank Word or WordPad document. Notice that an XPS document without structure elements pastes as plain text, not as a formatted table.
34 </p></li><li><p>
35 Click <b>File</b> | <b>Open...</b> and select "Spec_withStructure.xps". Select a part of Table 1-1 and paste it into the Word or WordPad document. Notice that an XPS document with structure elements uses rich text to paste the selection as styled table elements.
36 </p></li><li><p>
37 Next click <b>File</b> | <b>Add Structure...</b>. The Add Structure process copies "Spec_withoutStructure.xps" to a new file and then programmatically adds to the new document the two structure elements contained in "FixedPage1_structure.xaml" and "FixedPage2_structure.xaml". The resulting new XPS document is equivalent to "Spec_withStructure.xps".
38 </p></li><li><p>
39 Click <b>File</b> | <b>Open...</b> and set <b>Files of Type</b> to "All" to select one of the .xaml document structure resource files to view.
40 </p></li></ol><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
41 The <i>Document Structure</i> sample also contains two subfolders, "Spec_withoutStructure-xps" and "Spec_withStructure-xps". Each of these folders contains the unzipped* version of the "Spec_withoutStructure-xps" and "Spec_withStructure-xps" files.
42 </p><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
43 *Note - To examine the contents of an XPS document, temporarily change the file extension to ".zip" and then open the resulting zip file.
44 </p><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
45 This sample demonstrates a specific feature of the Windows Presentation Foundation (WPF) and, consequently, does not follow application development best practices. For comprehensive coverage of WPF and Microsoft .NET Framework application development best practices, refer to the following as appropriate:
46 </p><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
47 Accessibility - <span sdata="link">Accessibility Best Practices</span></p><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
48 Security - <span sdata="link">Windows Presentation Foundation Security</span></p><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
49 Localization - <span sdata="link">WPF Globalization and Localization Overview</span></p></div><h1 class="heading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><span onclick="ExpandCollapse(sectionToggle0)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(sectionToggle0, event)" tabindex="0">Building the Sample</span></h1><div id="sectionSection0" class="section"><ul xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p>
50 Install the Windows Software Development Kit (SDK) and open its build environment command window. On the Start menu, point to All Programs, Microsoft Windows SDK, and then click CMD Shell.
51 </p></li><li><p>
52 Download the sample, usually from the software development kit (SDK) documentation, to your hard disk drive.
53 </p></li><li><p>
54 To build the sample from the build environment command window, go to the source directory of the sample. At the command prompt, type MSBUILD.
55 </p></li><li><p>
56 To build the sample in Microsoft Visual Studio, load the sample solution or project file and then press CTRL+SHIFT+B.
57 </p></li></ul></div><h1 class="heading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><span onclick="ExpandCollapse(sectionToggle1)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(sectionToggle1, event)" tabindex="0">Running the Sample</span></h1><div id="sectionSection1" class="section"><ul xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p>
58 To run the compiled sample from the build environment command window, execute the .exe file in the Bin\Debug or Bin\Release folder contained under the sample source code folder.
59 </p></li><li><p>
60 To run the compiled sample with debugging in Visual Studio, press F5.
61 </p></li></ul></div><h1 class="heading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><span onclick="ExpandCollapse(seeAlsoToggle)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(seeAlsoToggle, event)" tabindex="0">See Also</span></h1><div id="seeAlsoSection" class="section"><h4 class="subHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Tasks</h4><div class="seeAlsoStyle"><span sdata="link" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Creating an XPS Document Sample</span></div><h4 class="subHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Reference</h4><div class="seeAlsoStyle"><span sdata="cer" target="T:System.Windows.Controls.DocumentViewer" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">DocumentViewer</span></div><h4 class="subHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Other Resources</h4><div class="seeAlsoStyle"><span sdata="link" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">XPS Samples</span></div><div class="seeAlsoStyle">XML Paper Specification (XPS)</div></div></div></div></body></html>