<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1138151560829907108</atom:id><lastBuildDate>Sat, 25 Feb 2012 14:54:58 +0000</lastBuildDate><title>Cathals Corner</title><description /><link>http://cathalscorner.blogspot.com/</link><managingEditor>noreply@blogger.com (Cathal Coffey)</managingEditor><generator>Blogger</generator><openSearch:totalResults>18</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CathalsCorner" /><feedburner:info uri="cathalscorner" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-529926850321306975</guid><pubDate>Thu, 23 Dec 2010 15:54:00 +0000</pubDate><atom:updated>2010-12-23T07:54:41.641-08:00</atom:updated><title>Programmatically manipulate an Image imbedded inside a DocX document</title><description>&lt;p&gt;This example uses DocX to write the text “Hello World” into an Image embedded inside a .docx document.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Make sure the document Input.docx exists and that it contains an Image.&lt;/p&gt;  &lt;p&gt;Below is an example Input.docx and Output.docx&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_3lwcqZZH2Ts/TRNwuUMyhZI/AAAAAAAAAF0/lissVmWj9Mg/s1600-h/image%5B8%5D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="left" src="http://lh5.ggpht.com/_3lwcqZZH2Ts/TRNwu1WKczI/AAAAAAAAAF4/KdHO73DVhEI/image_thumb%5B4%5D.png?imgmax=800" width="280" height="145" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_3lwcqZZH2Ts/TRNwvb21eQI/AAAAAAAAAF8/UWEQwou-bsA/s1600-h/image%5B9%5D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_3lwcqZZH2Ts/TRNwwJt03aI/AAAAAAAAAGA/Gk5GQyoz1RA/image_thumb%5B5%5D.png?imgmax=800" width="287" height="145" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:95c741ff-b673-4923-9962-95b35cf77ec2" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Text.RegularExpressions;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; Novacode;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Drawing;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Threading.Tasks;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.IO;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Diagnostics;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Drawing.Imaging;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; testDocX&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Open the document Input.docx.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Load(&lt;span style="color:#a31515"&gt;&amp;quot;Input.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Make sure this document has at least one Image.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (document.Images.Count() &amp;gt; 0)&lt;/li&gt; &lt;li&gt;                {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                    Novacode.&lt;span style="color:#2b91af"&gt;Image&lt;/span&gt; img = document.Images[0];&lt;/li&gt; &lt;li&gt;                    CoolExample(img, &lt;span style="color:#a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                    &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515"&gt;&amp;quot;The provided document contains no Images.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Save this document as Output.docx.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                document.SaveAs(&lt;span style="color:#a31515"&gt;&amp;quot;Output.docx&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;            }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#008000"&gt;// Write the given string into this Image.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; CoolExample(Novacode.&lt;span style="color:#2b91af"&gt;Image&lt;/span&gt; img, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; str)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Write &amp;quot;Hello World&amp;quot; into this Image.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Bitmap&lt;/span&gt; b = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Bitmap&lt;/span&gt;(img.GetStream(&lt;span style="color:#2b91af"&gt;FileMode&lt;/span&gt;.Open, &lt;span style="color:#2b91af"&gt;FileAccess&lt;/span&gt;.ReadWrite));&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;/* &lt;/span&gt;&lt;/li&gt; &lt;li&gt;             &lt;span style="color:#008000"&gt;* Get the Graphics object for this Bitmap.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;             &lt;span style="color:#008000"&gt;* The Graphics object provides functions for drawing.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;             &lt;span style="color:#008000"&gt;*/&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Graphics&lt;/span&gt; g = &lt;span style="color:#2b91af"&gt;Graphics&lt;/span&gt;.FromImage(b);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Draw the string &amp;quot;Hello World&amp;quot;.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            g.DrawString&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            (&lt;/li&gt; &lt;li&gt;                str,&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Font&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;Tahoma&amp;quot;&lt;/span&gt;, 20),&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#2b91af"&gt;Brushes&lt;/span&gt;.Blue,&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;PointF&lt;/span&gt;(0, 0)&lt;/li&gt; &lt;li&gt;            );&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Save this Bitmap back into the document using a Create&amp;#92;Write stream.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            b.Save(img.GetStream(&lt;span style="color:#2b91af"&gt;FileMode&lt;/span&gt;.Create, &lt;span style="color:#2b91af"&gt;FileAccess&lt;/span&gt;.Write), &lt;span style="color:#2b91af"&gt;ImageFormat&lt;/span&gt;.Png);&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-529926850321306975?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8ovhirzsVdg6rr0CySK3hnDNNu4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ovhirzsVdg6rr0CySK3hnDNNu4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8ovhirzsVdg6rr0CySK3hnDNNu4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8ovhirzsVdg6rr0CySK3hnDNNu4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/eLpRp9qsxNs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/eLpRp9qsxNs/programmatically-manipulate-image.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh5.ggpht.com/_3lwcqZZH2Ts/TRNwu1WKczI/AAAAAAAAAF4/KdHO73DVhEI/s72-c/image_thumb%5B4%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2010/12/programmatically-manipulate-image.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-7868670556773784406</guid><pubDate>Thu, 23 Dec 2010 15:29:00 +0000</pubDate><atom:updated>2010-12-23T07:29:58.730-08:00</atom:updated><title>Replace text across many documents in Parallel</title><description>&lt;p&gt;.NET 4.0 makes Parallel programming easy. Below is an example of how to replace text across many .docx documents in parallel.&lt;/p&gt;  &lt;p&gt;This example contains 4 functions.&lt;/p&gt;  &lt;p&gt;1) &lt;strong&gt;Replace:&lt;/strong&gt; This function opens a document and does the text replace.    &lt;br /&gt;    &lt;br /&gt;2) &lt;strong&gt;NonParallel_ReplaceText:&lt;/strong&gt; This is how you would replace text across multiple documents without using parallel execution. This is included for comparisons sake.    &lt;br /&gt;    &lt;br /&gt;3) &lt;strong&gt;Parallel_ReplaceText:&lt;/strong&gt; This is how you would replace text across multiple documents in parallel.&lt;/p&gt;  &lt;p&gt;4&lt;strong&gt;) Main:&lt;/strong&gt; This function does the work sequentially and then in parallel and prints the time taken for both.&lt;/p&gt;  &lt;p&gt;Before running this code replace the line    &lt;br /&gt;DirectoryInfo di = new DirectoryInfo(@&amp;quot;C:\Users\Cathal\Desktop\multiple&amp;quot;);     &lt;br /&gt;with a directory on your machine that contains many .docx documents.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note(s):&lt;/strong&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;1) There is over head when executing code in Parallel. Make sure your doing enough work to justify Parallel execution. For example: if you run this code on 4 small documents, the function NonParallel_ReplaceText&lt;strong&gt;&amp;#160;&lt;/strong&gt;may run faster than its parallel equivalent.&lt;/p&gt;  &lt;p&gt;2) Run this example without the debugger, the debugger adds overhead which makes this code run significantly slower.&lt;/p&gt;  &lt;p&gt;3) You can download and build the latest version of DocX.dll from here &lt;a title="http://docx.codeplex.com/SourceControl/list/changesets#" href="http://docx.codeplex.com/SourceControl/list/changesets#"&gt;http://docx.codeplex.com/SourceControl/list/changesets#&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;   &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c4c91e8f-8525-4994-a265-7ba226e98fd2" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Text.RegularExpressions;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; Novacode;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Drawing;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Threading.Tasks;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.IO;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Diagnostics;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; testDocX&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Directory containing many .docx documents.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;DirectoryInfo&lt;/span&gt; di = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;DirectoryInfo&lt;/span&gt;(&lt;span style="color:#a31515"&gt;@&amp;quot;C:&amp;#92;Users&amp;#92;Cathal&amp;#92;Desktop&amp;#92;multiple&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Print out the time taken in miliseconds.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515"&gt;&amp;quot;Non-Parallel took &amp;quot;&lt;/span&gt; + NonParallel_ReplaceText(di, &lt;span style="color:#a31515"&gt;&amp;quot;pear&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;&amp;quot;raep&amp;quot;&lt;/span&gt;) + &lt;span style="color:#a31515"&gt;&amp;quot; miliseconds.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Print out the time taken in miliseconds.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color:#a31515"&gt;&amp;quot;Parallel took &amp;quot;&lt;/span&gt; + Parallel_ReplaceText(di, &lt;span style="color:#a31515"&gt;&amp;quot;raep&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;&amp;quot;pear&amp;quot;&lt;/span&gt;) + &lt;span style="color:#a31515"&gt;&amp;quot; miliseconds.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Wait until the user presses a key before exiting.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.ReadKey();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#008000"&gt;// Replace text accross multiple documents sequentially.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;long&lt;/span&gt; NonParallel_ReplaceText(&lt;span style="color:#2b91af"&gt;DirectoryInfo&lt;/span&gt; di, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; a, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; b)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Create a new Stopwatch, we will use this to time execution.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Stopwatch&lt;/span&gt; sw = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Stopwatch&lt;/span&gt;();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            sw.Start(); &lt;span style="color:#008000"&gt;// Start the stop watch.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Loop through each document in this specified direction.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;FileInfo&lt;/span&gt; fi &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; di.GetFiles())&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Replace text in this document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                Replace(fi.FullName, a, b);&lt;/li&gt; &lt;li&gt;            }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            sw.Stop(); &lt;span style="color:#008000"&gt;// Stop the stop watch.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Return the time taken in miliseconds.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; sw.ElapsedMilliseconds;&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#008000"&gt;// Replace text accross multiple documents in Parallel.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;long&lt;/span&gt; Parallel_ReplaceText(&lt;span style="color:#2b91af"&gt;DirectoryInfo&lt;/span&gt; di, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; a, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; b)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Create a new Stopwatch, we will use this to time execution.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Stopwatch&lt;/span&gt; sw = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Stopwatch&lt;/span&gt;();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            sw.Start(); &lt;span style="color:#008000"&gt;// Start the stop watch.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Loop through each document in this specified direction.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            System.Threading.Tasks.&lt;span style="color:#2b91af"&gt;Parallel&lt;/span&gt;.ForEach&lt;/li&gt; &lt;li&gt;            (&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                di.GetFiles(), &lt;/li&gt; &lt;li&gt;                currentFile =&amp;gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                {&lt;/li&gt; &lt;li&gt;                    Replace(currentFile.FullName, a, b);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                }&lt;/li&gt; &lt;li&gt;            );&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            sw.Stop(); &lt;span style="color:#008000"&gt;// Stop the stop watch.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Return the time taken in miliseconds.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; sw.ElapsedMilliseconds;&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#008000"&gt;// Replace the string a with the string b in filename and save the changes.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Replace(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; filename, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; a, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; b)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Load the document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Load(filename))&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Replace text in this document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                document.ReplaceText(a, b);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Save changes made to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                document.Save();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            } &lt;span style="color:#008000"&gt;// Release this document from memory.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-7868670556773784406?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hRo9q1f6c-iyuN-rLhHsZJdXrI0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hRo9q1f6c-iyuN-rLhHsZJdXrI0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hRo9q1f6c-iyuN-rLhHsZJdXrI0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hRo9q1f6c-iyuN-rLhHsZJdXrI0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/0WetHJu7Mgg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/0WetHJu7Mgg/replace-text-across-many-documents-in.html</link><author>noreply@blogger.com (Cathal Coffey)</author><thr:total>2</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2010/12/replace-text-across-many-documents-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-6094131149968427643</guid><pubDate>Mon, 28 Jun 2010 11:17:00 +0000</pubDate><atom:updated>2010-06-28T04:17:19.564-07:00</atom:updated><title>DocX version 1.0.0.10</title><description>&lt;p&gt;This version of DocX contains support for Headers and Footers.    &lt;br /&gt;There are a few different options to choose from.&lt;/p&gt;  &lt;p&gt;1) You can have a default Header and Footer for the entire document.    &lt;br /&gt;2) You can have a different Header and Footer for the first page.     &lt;br /&gt;3) You can have a different Header and Footer for odd and even pages.&lt;/p&gt;  &lt;p&gt;The first code example generates a document with a default Header and Footer that is applied to all pages.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; padding-left: 0px; width: 472px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e45663d7-312b-47a1-8c23-67a847b7b780" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Default Header and Footer&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#008000"&gt;// Create a new document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;@&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Add Header and Footer support to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.AddHeaders();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    document.AddFooters();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Get the default Header for this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Header&lt;/span&gt; header_default = document.Headers.odd;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Get the default Footer for this document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Footer&lt;/span&gt; footer_default = document.Footers.odd;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the default Header.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p1 = header_default.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p1.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Header.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p2 = document.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p2.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Document.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the default Footer.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p3 = footer_default.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p3.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Footer.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li&gt;    &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Save all changes to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.Save();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;span style="color:#008000"&gt;// Release this document from memory.&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The code directly above will generate a document that looks like the image below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/TCiEqrgxa8I/AAAAAAAAAFE/ntoGkgeTbPE/s1600-h/Untitled23.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled2" border="0" alt="Untitled2" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/TCiErZs8qBI/AAAAAAAAAFI/UduiCOonmFk/Untitled2_thumb1.png?imgmax=800" width="494" height="194" /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;The second code example generates a document which has a different Header and Footer for the first page. All other pages use the default Header and Footer. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ee02dedc-bda4-41e7-897a-6beaadf2b6d8" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;First Header and Footer&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#008000"&gt;// Create a new document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;@&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Add Header and Footer support to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.AddHeaders();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    document.AddFooters();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Get the first Header for this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Header&lt;/span&gt; header_first = document.Headers.first;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Get the first Footer for this document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Footer&lt;/span&gt; footer_first = document.Footers.first;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the first Header.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p1 = header_first.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p1.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello First Header.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p2 = document.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p2.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Hello First page.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;    &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Create a second page to show that only the first has a header and footer.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    p2.InsertPageBreakAfterSelf();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph after the page break.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p3 = document.InsertParagraph();&lt;/li&gt; &lt;li&gt;    p3.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Second page.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the first Footer.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p4 = footer_first.InsertParagraph();&lt;/li&gt; &lt;li&gt;    p4.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello First Footer.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Force the first page to have a different Header and Footer.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    document.DifferentFirstPage = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Save all changes to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.Save();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;span style="color:#008000"&gt;// Release this document from memory.&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The code directly above will generate a document that looks like the image below. Notice that the second page has an empty Header and Footer, this will also be the same for all proceeding pages.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/TCiEsah-U1I/AAAAAAAAAFM/J6KDptTBBMk/s1600-h/Untitled34.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Untitled3" border="0" alt="Untitled3" src="http://lh3.ggpht.com/_3lwcqZZH2Ts/TCiEtY5p0qI/AAAAAAAAAFQ/eK95MTqUgjk/Untitled3_thumb2.png?imgmax=800" width="520" height="375" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The third code example generates a document which has a different Header and Footer for odd and even pages. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c0626c31-9e1a-47f0-be98-b6f7310518b5" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Odd and Even Header and Footer&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#008000"&gt;// Create a new document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;@&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Add Header and Footer support to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.AddHeaders();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    document.AddFooters();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Get the odd and even Headers for this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Header&lt;/span&gt; header_odd = document.Headers.odd;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Header&lt;/span&gt; header_even = document.Headers.even;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Get the odd and even Footer for this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Footer&lt;/span&gt; footer_odd = document.Footers.odd;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Footer&lt;/span&gt; footer_even = document.Footers.even;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the odd Header.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p1 = header_odd.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p1.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Odd Header.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the even Header.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p2 = header_even.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p2.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Even Header.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p3 = document.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p3.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Hello First page.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;    &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Create a second page to show that even and odd pages have different headers and footers.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    p3.InsertPageBreakAfterSelf();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph after the page break.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p4 = document.InsertParagraph();&lt;/li&gt; &lt;li&gt;    p4.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Second page.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the odd Footer.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p5 = footer_odd.InsertParagraph();&lt;/li&gt; &lt;li&gt;    p5.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Odd Footer.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Insert a Paragraph into the even Footer.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p6 = footer_even.InsertParagraph();&lt;/li&gt; &lt;li&gt;    p6.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello Even Footer.&amp;quot;&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Force odd &amp;amp; even pages to have different Headers and Footers.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    document.DifferentOddAndEvenPages = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Save all changes to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.Save();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;span style="color:#008000"&gt;// Release this document from memory.&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The code directly above will generate a document that looks like the image below. Note that the first page has a different header and footer than the second.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/TCiEuJAEUXI/AAAAAAAAAFU/6CZp4CcFG0k/s1600-h/Untitled43.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Untitled4" border="0" alt="Untitled4" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/TCiEvBntxgI/AAAAAAAAAFY/QRgVNUdCO3Y/Untitled4_thumb1.png?imgmax=800" width="523" height="374" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It is of course possible to create a document with a different header and footer for odd, even and the first page. You just need to set the following two properties to true.&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000"&gt;// Force the first, odd &amp;amp; even pages to have different Headers and Footers.&lt;/font&gt;     &lt;br /&gt;document.DifferentOddAndEvenPages = &lt;font color="#0080ff"&gt;true&lt;/font&gt;;     &lt;br /&gt;document.DifferentFirstPage = &lt;font color="#0080ff"&gt;true&lt;/font&gt;;&lt;/p&gt;  &lt;p&gt;This version of DocX does not support page numbering inside Headers and Footers. This feature will require much more development time due to the shear number of options available for numbering. I hope to add this feature in the near future.&lt;/p&gt;  &lt;p&gt;Happy coding,    &lt;br /&gt;Cathal&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-6094131149968427643?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KxayJ2Zd2RXQQU44Arr-Ue1t5vw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KxayJ2Zd2RXQQU44Arr-Ue1t5vw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KxayJ2Zd2RXQQU44Arr-Ue1t5vw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KxayJ2Zd2RXQQU44Arr-Ue1t5vw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/UDN2Lgms6dE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/UDN2Lgms6dE/docx-version-10010.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh6.ggpht.com/_3lwcqZZH2Ts/TCiErZs8qBI/AAAAAAAAAFI/UduiCOonmFk/s72-c/Untitled2_thumb1.png?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2010/06/docx-version-10010.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-2991775649901842170</guid><pubDate>Mon, 14 Jun 2010 15:09:00 +0000</pubDate><atom:updated>2010-06-14T08:09:17.034-07:00</atom:updated><title>Cathal: Why did you create DocX?</title><description>&lt;p&gt;Before I created the OpenSource library “DocX”, there were two methods by which a .docx document could be generated programmatically. This blog post demonstrates each method in turn by generating a simple HelloWorld document.&amp;#160; &lt;/p&gt;  &lt;p&gt;After experiencing both methods for document creation I hope you will agree that DocX is a interesting alternative. DocX was designed with simplicity in mind. It dose not require the user to have any knowledge of how .docx documents are stored or organised internally.&lt;/p&gt;  &lt;h3&gt;Method 1: HelloWorld using Office Interop&lt;/h3&gt;  &lt;p&gt;Make sure that you have added a reference to &lt;/p&gt;  &lt;p&gt;1) Microsoft.Office.Interop.Word (version 12.0.0.0)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_3lwcqZZH2Ts/TBZGEjj-gqI/AAAAAAAAAEs/OZOJ7xeLxdw/s1600-h/image%5B8%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_3lwcqZZH2Ts/TBZGE4MJQ-I/AAAAAAAAAEw/HpA47fnd8S0/image_thumb%5B2%5D.png?imgmax=800" width="244" height="148" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f7bd20bf-20b9-4563-9225-deed1a0777f4" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;OfficeInterop HelloWorld&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; Microsoft.Office.Interop.Word;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Reflection;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.IO;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; OfficeInterop&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li&gt;        {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Get the path of the executing assembly.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; path = &lt;span style="color:#2b91af"&gt;Path&lt;/span&gt;.GetDirectoryName(&lt;span style="color:#2b91af"&gt;Assembly&lt;/span&gt;.GetExecutingAssembly().Location);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// The location to save the file.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Object&lt;/span&gt; oSaveAsFile = (&lt;span style="color:#2b91af"&gt;Object&lt;/span&gt;)(path + &lt;span style="color:#a31515"&gt;@&amp;quot;&amp;#92;Test.docx&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Object of Missing &amp;quot;Null Value&amp;quot;.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Object&lt;/span&gt; oMissing = System.Reflection.&lt;span style="color:#2b91af"&gt;Missing&lt;/span&gt;.Value;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Object of false.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Object&lt;/span&gt; oFalse = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Create object of Word and Document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Application&lt;/span&gt; oWord = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Application&lt;/span&gt;();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Document&lt;/span&gt; oWordDoc = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Document&lt;/span&gt;();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Don&amp;#39;t display Word.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            oWord.Visible = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Add a new document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            oWordDoc = oWord.Documents.Add(&lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing);&lt;/li&gt; &lt;li&gt;            &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Enter some text with the font Arial Black.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            oWord.Selection.Font.Name = &lt;span style="color:#a31515"&gt;&amp;quot;Arial Black&amp;quot;&lt;/span&gt;;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            oWord.Selection.TypeText(&lt;span style="color:#a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Save the document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            oWordDoc.SaveAs&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            (&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oSaveAsFile, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing,&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing,&lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing,&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing,&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing&lt;/li&gt; &lt;li&gt;            );&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Close the file.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            oWordDoc.Close(&lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oFalse, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;             &lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Quit Word.exe&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            oWord.Quit(&lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing);&lt;/li&gt; &lt;li&gt;        }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Method 2: HelloWorld using the OOXML SDK&lt;/h3&gt;  &lt;p&gt;Make sure that you have added a reference to both &lt;/p&gt;  &lt;p&gt;1) DocumentFormat.OpenXml (version 2.0.5022.0)   &lt;br /&gt;2) WindowsBase (version 3.0.0.0)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_3lwcqZZH2Ts/TBZGFa9fn-I/AAAAAAAAAE0/dx6kdlh_HM0/s1600-h/image%5B5%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_3lwcqZZH2Ts/TBZGGfjdttI/AAAAAAAAAE4/9KN9d_liWuU/image_thumb%5B1%5D.png?imgmax=800" width="244" height="167" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6275a752-5ebd-4062-b294-23d0c95b0133" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;OOXML HelloWorld&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; DocumentFormat.OpenXml.Packaging;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; DocumentFormat.OpenXml.Wordprocessing;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; DocumentFormat.OpenXml;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; OOXML&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Create a package.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;WordprocessingDocument&lt;/span&gt; doc = &lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;WordprocessingDocument&lt;/span&gt;.Create&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            (&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#a31515"&gt;@&amp;quot;Test.docx&amp;quot;&lt;/span&gt;,&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#2b91af"&gt;WordprocessingDocumentType&lt;/span&gt;.Document&lt;/li&gt; &lt;li&gt;            );&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Create a main document part and add it to the package.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;MainDocumentPart&lt;/span&gt; mainPart = doc.AddMainDocumentPart();&lt;/li&gt; &lt;li&gt;            mainPart.Document = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Document&lt;/span&gt;();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Create some content.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Text&lt;/span&gt; textFirstLine = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Text&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;Run&lt;/span&gt; run = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Run&lt;/span&gt;(textFirstLine);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; para = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt;(run);&lt;/li&gt; &lt;li&gt;           &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#008000"&gt;// Apply a font.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#2b91af"&gt;RunProperties&lt;/span&gt; runProp = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;RunProperties&lt;/span&gt;();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;RunFonts&lt;/span&gt; runFont = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;RunFonts&lt;/span&gt;();&lt;/li&gt; &lt;li&gt;            runFont.Ascii = &lt;span style="color:#a31515"&gt;&amp;quot;Arial Black&amp;quot;&lt;/span&gt;;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            runProp.Append(runFont);&lt;/li&gt; &lt;li&gt;            run.PrependChild&amp;lt;&lt;span style="color:#2b91af"&gt;RunProperties&lt;/span&gt;&amp;gt;(runProp);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt; &lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;// Add the content into the document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#2b91af"&gt;Body&lt;/span&gt; body = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Body&lt;/span&gt;(para);&lt;/li&gt; &lt;li&gt;            mainPart.Document.Append(body);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;/li&gt; &lt;li&gt;            &lt;span style="color:#008000"&gt;/* Save and close */&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            mainPart.Document.Save();&lt;/li&gt; &lt;li&gt;            doc.Close();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt; &lt;li&gt;    }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h3&gt;HelloWorld using DocX&lt;/h3&gt;  &lt;p&gt;Make sure that you have added a reference to &lt;/p&gt;  &lt;p&gt;1) DocX (version 1.0.0.9)   &lt;br /&gt;2) System.Drawing (version 2.0.0.0)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_3lwcqZZH2Ts/TBZGGvKVf9I/AAAAAAAAAE8/Fd8DCNJnxmk/s1600-h/image%5B14%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_3lwcqZZH2Ts/TBZGHJmAVVI/AAAAAAAAAFA/7JDexXr3kaI/image_thumb%5B4%5D.png?imgmax=800" width="244" height="172" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c8ed1217-6a30-4933-a497-db9705c48338" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;DocX HelloWorld&lt;/div&gt; &lt;div style="background: #ddd; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; Novacode;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Drawing;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; DocXHelloWorld&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt; &lt;li&gt;        &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt; &lt;li&gt;            &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Add a new Paragraph to the document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p = document.InsertParagraph();&lt;/li&gt; &lt;li&gt;                &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Append some text.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                p.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;).Font(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;FontFamily&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;Arial Black&amp;quot;&lt;/span&gt;));&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Save the document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                document.Save();&lt;/li&gt; &lt;li&gt;            }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt; &lt;li&gt;    }&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-2991775649901842170?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Z_cozyODseH9sopUvd2LVzZ7s7U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Z_cozyODseH9sopUvd2LVzZ7s7U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Z_cozyODseH9sopUvd2LVzZ7s7U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Z_cozyODseH9sopUvd2LVzZ7s7U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/gNwZg453Ee0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/gNwZg453Ee0/cathal-why-did-you-create-docx.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh3.ggpht.com/_3lwcqZZH2Ts/TBZGE4MJQ-I/AAAAAAAAAEw/HpA47fnd8S0/s72-c/image_thumb%5B2%5D.png?imgmax=800" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2010/06/cathal-why-did-you-create-docx.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-6261338120456029280</guid><pubDate>Thu, 10 Jun 2010 13:35:00 +0000</pubDate><atom:updated>2010-06-10T06:40:03.516-07:00</atom:updated><title>Fluid Paragraph creation with Append</title><description>&lt;p&gt;DocX v1.0.0.9 makes Paragraph creation even easier. The original idea of using Append in this manor came from a DocX user Morten Bjerre. Once again Morten I would like to say thank you for your contribution.&lt;/p&gt;  &lt;p&gt;The below code creates a document with the following content.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;A Picture&lt;/li&gt;    &lt;li&gt;A Hyperlink&lt;/li&gt;    &lt;li&gt;Different fonts&lt;/li&gt;    &lt;li&gt;Different text styles&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I hope you will agree that Append() and its variants [AppendLine(), AppendPicture() and AppendHyperlink()] make the creation of Paragraphs flow in a very fluid manor.&lt;/p&gt;  &lt;p&gt;The below code creates the following output.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/TBDqCajjNhI/AAAAAAAAAEk/0WIpSRF3Swc/s1600-h/Untitled%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Untitled" border="0" alt="Untitled" src="http://lh3.ggpht.com/_3lwcqZZH2Ts/TBDqDQhh1oI/AAAAAAAAAEo/B_ED-n9ie6g/Untitled_thumb%5B2%5D.png?imgmax=800" width="492" height="299" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;div style="padding-bottom: 0px; padding-left: 0px; width: 489px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:09c632f1-6d7e-4943-a0c3-f0345f505782" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000"&gt;// Create a document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;            {&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Add a hyperlink into the document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#2b91af"&gt;Hyperlink&lt;/span&gt; link = document.AddHyperlink(&lt;span style="color:#a31515"&gt;&amp;quot;link&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;http://www.google.com&amp;quot;&lt;/span&gt;));&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Add a Table into the document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#2b91af"&gt;Table&lt;/span&gt; table = document.AddTable(2, 2);&lt;/li&gt; &lt;li&gt;                table.Design = &lt;span style="color:#2b91af"&gt;TableDesign&lt;/span&gt;.ColorfulGridAccent2;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                table.Alignment = &lt;span style="color:#2b91af"&gt;Alignment&lt;/span&gt;.center;&lt;/li&gt; &lt;li&gt;                table.Rows[0].Cells[0].Paragraphs[0].Append(&lt;span style="color:#a31515"&gt;&amp;quot;3&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                table.Rows[0].Cells[1].Paragraphs[0].Append(&lt;span style="color:#a31515"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;                table.Rows[1].Cells[0].Paragraphs[0].Append(&lt;span style="color:#a31515"&gt;&amp;quot;4&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                table.Rows[1].Cells[1].Paragraphs[0].Append(&lt;span style="color:#a31515"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Add an image into the document.    &lt;/span&gt;&lt;/li&gt; &lt;li&gt;                Novacode.&lt;span style="color:#2b91af"&gt;Image&lt;/span&gt; image = document.AddImage(&lt;span style="color:#a31515"&gt;&amp;quot;Image.jpg&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Create a picture (A custom view of an Image).&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#2b91af"&gt;Picture&lt;/span&gt; picture = image.CreatePicture();&lt;/li&gt; &lt;li&gt;                picture.Rotation = 10;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                picture.SetPictureShape(&lt;span style="color:#2b91af"&gt;BasicShapes&lt;/span&gt;.cube);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Insert a new Paragraph into the document. &lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; title = document.InsertParagraph().Append(&lt;span style="color:#a31515"&gt;&amp;quot;Test&amp;quot;&lt;/span&gt;).FontSize(20).Font(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;FontFamily&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;Comic Sans MS&amp;quot;&lt;/span&gt;));&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                title.Alignment = &lt;span style="color:#2b91af"&gt;Alignment&lt;/span&gt;.center;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Insert a new Paragraph into the document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p1 = document.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Append content to the Paragraph&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                p1.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;This line contains a &amp;quot;&lt;/span&gt;).Append(&lt;span style="color:#a31515"&gt;&amp;quot;bold&amp;quot;&lt;/span&gt;).Bold().Append(&lt;span style="color:#a31515"&gt;&amp;quot; word.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;                p1.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Here is a cool &amp;quot;&lt;/span&gt;).AppendHyperlink(link).Append(&lt;span style="color:#a31515"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                p1.AppendLine();&lt;/li&gt; &lt;li&gt;                p1.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Check out this picture &amp;quot;&lt;/span&gt;).AppendPicture(picture).Append(&lt;span style="color:#a31515"&gt;&amp;quot; its funky don&amp;#39;t you think?&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                p1.AppendLine();&lt;/li&gt; &lt;li&gt;                p1.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Can you check this Table of figures for me?&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                p1.AppendLine();&lt;/li&gt; &lt;li&gt;                &lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Insert the Table after Paragraph 1.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                p1.InsertTableAfterSelf(table);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Insert a new Paragraph into the document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p2 = document.InsertParagraph();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                &lt;span style="color:#008000"&gt;// Append content to the Paragraph.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;                p2.AppendLine(&lt;span style="color:#a31515"&gt;&amp;quot;Is it correct?&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;                &lt;span style="color:#008000"&gt;// Save this document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;                document.Save();&lt;/li&gt; &lt;li&gt;            }&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;If you would like to request a new feature, report a bug or just say hi, send me an email at &lt;a href="mailto:coffey.cathal@gmail.com"&gt;coffey.cathal@gmail.com&lt;/a&gt;    &lt;br /&gt;    &lt;br /&gt;Happy coding,    &lt;br /&gt;Cathal&lt;/p&gt;  &lt;h4&gt;Future&lt;/h4&gt;  &lt;p&gt;As always, I offer this code to you for free. I am however a student and if you would like to help me pay of some of my student debt , you can make a donation to DocX via paypal.&lt;/p&gt; &lt;form method="post" action="https://www.paypal.com/cgi-bin/webscr"&gt;&lt;input type="hidden" name="cmd" /&gt; &lt;input type="hidden" name="business" /&gt; &lt;input type="hidden" name="lc" /&gt; &lt;input type="hidden" name="currency_code" /&gt; &lt;input type="hidden" name="bn" /&gt; &lt;input border="0" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" name="submit" /&gt; &lt;img border="0" alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /&gt; &lt;/form&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-6261338120456029280?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2lzMWd8_oIBmmYPeMsSsCvl2PAU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2lzMWd8_oIBmmYPeMsSsCvl2PAU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2lzMWd8_oIBmmYPeMsSsCvl2PAU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2lzMWd8_oIBmmYPeMsSsCvl2PAU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/98UxlPQHWdI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/98UxlPQHWdI/fluid-paragraph-creation-with-append.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh3.ggpht.com/_3lwcqZZH2Ts/TBDqDQhh1oI/AAAAAAAAAEo/B_ED-n9ie6g/s72-c/Untitled_thumb%5B2%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2010/06/fluid-paragraph-creation-with-append.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-7298903402127157796</guid><pubDate>Wed, 09 Jun 2010 19:21:00 +0000</pubDate><atom:updated>2010-06-09T12:42:44.156-07:00</atom:updated><title>DocX version 1.0.0.9</title><description>&lt;p&gt;The summer is finally here and so is DocX version 1.0.0.9. I would like to say sorry once again for the long wait but I simply couldn’t allow DocX to effect my final year college exams. &lt;/p&gt;  &lt;p&gt;I received lots of feature requests over the past few months. I intend to implement as many of these features as possible over the next few releases. I have decided to make many small releases instead of one large release.&lt;/p&gt;  &lt;h3&gt;So what's new in this release?&lt;/h3&gt;  &lt;h4&gt;1) Hyperlinks&lt;/h4&gt;  &lt;p&gt;DocX now supports hyperlinks. &lt;/p&gt;  &lt;p&gt;The Document class now contains AddHyperlink(string, Uri)    &lt;br /&gt;The Paragraph class now contains AppendHyperlink(Hyperlink);&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Example      &lt;br /&gt;&lt;/u&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5a2f3aa1-ede5-4adc-806d-49153eefc030" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000"&gt;// Create a document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;@&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Add a hyperlink to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Hyperlink&lt;/span&gt; h = document.AddHyperlink&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    (&lt;span style="color:#a31515"&gt;&amp;quot;Google&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;http://www.google.com&amp;quot;&lt;/span&gt;));&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Add a new Paragraph to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p = document.InsertParagraph();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p.Append(&lt;span style="color:#a31515"&gt;&amp;quot;My favourite search engine is &amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;    p.AppendHyperlink(h);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p.Append(&lt;span style="color:#a31515"&gt;&amp;quot;, I think it&amp;#39;s great.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Save all changes made to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.Save();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Output&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;a href="http://lh6.ggpht.com/_3lwcqZZH2Ts/TA_pv1cfKhI/AAAAAAAAAEE/UgZWe_QQS6c/s1600-h/clip_image002%5B4%5D%5B7%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image002[4]" border="0" alt="clip_image002[4]" src="http://lh3.ggpht.com/_3lwcqZZH2Ts/TA_pwfSC37I/AAAAAAAAAEI/YY9lCjLMvaA/clip_image002%5B4%5D_thumb%5B5%5D.jpg?imgmax=800" width="439" height="257" /&gt;&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;  &lt;h4&gt;2) Content Direction&lt;/h4&gt;  &lt;p&gt;The Paragraph class now contains a property called Direction which can be either LeftToRight or RightToLeft. This property has both a getter and setter function.&lt;/p&gt;  &lt;p&gt;To accommodate Paragraph Direction&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;The Document class now contains SetDirection(Direction) &lt;/li&gt;    &lt;li&gt;The Table class now contains SetDirection(Direction) &lt;/li&gt;    &lt;li&gt;The Row class now contains SetDirection(Direction) &lt;/li&gt;    &lt;li&gt;The Cell class now contains SetDirection(Direction) &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Where Direction is an enum with the choices LeftToRight and RightToLeft.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Example      &lt;br /&gt;&lt;/u&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:367ecf33-023b-4dab-9baf-39ffaf12b96c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000"&gt;// Create a new document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Create a new Paragraph with the text &amp;quot;Hello World&amp;quot;.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p = document.InsertParagraph(&lt;span style="color:#a31515"&gt;&amp;quot;Hello World.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Make this Paragraph flow right to left. Default is left to right.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p.Direction = &lt;span style="color:#2b91af"&gt;Direction&lt;/span&gt;.RightToLeft;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Save all changes made to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.Save();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;u&gt;Output&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;a href="http://lh6.ggpht.com/_3lwcqZZH2Ts/TA_pxRFJ7yI/AAAAAAAAAEM/nLVJOkCFQaw/s1600-h/clip_image002%5B6%5D%5B4%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image002[6]" border="0" alt="clip_image002[6]" src="http://lh5.ggpht.com/_3lwcqZZH2Ts/TA_pyAfFmMI/AAAAAAAAAEQ/HtYvu3CVxqQ/clip_image002%5B6%5D_thumb%5B2%5D.jpg?imgmax=800" width="425" height="149" /&gt;&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h4&gt;3) Indentation&lt;/h4&gt;  &lt;p&gt;The Paragraph class now contains four properties for setting Indentation. &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;IndentationFirstLine(float) which indents only the first line of a paragraph. &lt;/li&gt;    &lt;li&gt;IndentationHanging(float) which indents all but the first line of a paragraph. &lt;/li&gt;    &lt;li&gt;IndentationBefore(float) which indents before content. &lt;/li&gt;    &lt;li&gt;IndentationAfter(float) which indents after content. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;u&gt;Example      &lt;br /&gt;&lt;/u&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a46d7fa6-ae9c-4ac7-9cfe-7f049b86cf8c" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000"&gt;// Create a new document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Create a new Paragraph.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; p = document.InsertParagraph(&lt;span style="color:#a31515"&gt;&amp;quot;Line 1&amp;#92;nLine 2&amp;#92;nLine 3&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Indent only the first line of the Paragraph.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p.IndentationFirstLine = 1.0f;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Save all changes made to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    document.Save();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;u&gt;Output&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/TA_pym1e96I/AAAAAAAAAEU/7RnovGYwjBs/s1600-h/clip_image002%5B8%5D%5B3%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image002[8]" border="0" alt="clip_image002[8]" src="http://lh4.ggpht.com/_3lwcqZZH2Ts/TA_pzJakR0I/AAAAAAAAAEY/FfRohCwj0NE/clip_image002%5B8%5D_thumb%5B1%5D.jpg?imgmax=800" width="373" height="220" /&gt;&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;  &lt;h4&gt;4) Pictures&lt;/h4&gt;  &lt;p&gt;The Image class now contains a CreatePicture() function and the Paragraph class contains a AppendPicture(Picture) function. The below example should explain how these updates enable easier Paragraph building.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Example      &lt;br /&gt;&lt;/u&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6e1b04da-2bdc-4fa5-b70e-8f937eaa7797" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt; document = &lt;span style="color:#2b91af"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color:#a31515"&gt;&amp;quot;Test.docx&amp;quot;&lt;/span&gt;))&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Add an image to the document. &lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Image&lt;/span&gt; i = document.AddImage(&lt;span style="color:#a31515"&gt;@&amp;quot;Image.jpg&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Create a picture i.e. (A custom view of an image)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#2b91af"&gt;Picture&lt;/span&gt; p = i.CreatePicture();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    p.FlipHorizontal = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;    p.Rotation = 10;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Create a new Paragraph.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#2b91af"&gt;Paragraph&lt;/span&gt; par = document.InsertParagraph();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    &lt;span style="color:#008000"&gt;// Append content to the Paragraph.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    par.Append(&lt;span style="color:#a31515"&gt;&amp;quot;Here is a cool picture&amp;quot;&lt;/span&gt;)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;       .AppendPicture(p)&lt;/li&gt; &lt;li&gt;       .Append(&lt;span style="color:#a31515"&gt;&amp;quot; don&amp;#39;t you think so?&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;    &lt;span style="color:#008000"&gt;// Save all changes made to this document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;    document.Save();&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;u&gt;Output&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;a href="http://lh3.ggpht.com/_3lwcqZZH2Ts/TA_pzhqBQLI/AAAAAAAAAEc/1UpSbzijmrs/s1600-h/clip_image002%5B10%5D%5B3%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image002[10]" border="0" alt="clip_image002[10]" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/TA_p0vbUw8I/AAAAAAAAAEg/uclJ2gWfCcc/clip_image002%5B10%5D_thumb%5B1%5D.jpg?imgmax=800" width="358" height="237" /&gt;&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;  &lt;h4&gt;Future&lt;/h4&gt;  &lt;p&gt;As always, I offer this code to you for free. I am however a student and if you would like to help me pay of some of my student debt , you can make a donation to DocX via paypal.&lt;/p&gt;  &lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post"&gt; &lt;input type="hidden" name="cmd" value="_donations"&gt; &lt;input type="hidden" name="business" value="GHSZDFX6JHS2A"&gt; &lt;input type="hidden" name="lc" value="IE"&gt; &lt;input type="hidden" name="currency_code" value="EUR"&gt; &lt;input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted"&gt; &lt;input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"&gt; &lt;img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"&gt; &lt;/form&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-7298903402127157796?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9EyExt-Jmc8sLEkIRp30qKHsxBY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9EyExt-Jmc8sLEkIRp30qKHsxBY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9EyExt-Jmc8sLEkIRp30qKHsxBY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9EyExt-Jmc8sLEkIRp30qKHsxBY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/rGsT8433DZM" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/rGsT8433DZM/docx-version-1009.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh3.ggpht.com/_3lwcqZZH2Ts/TA_pwfSC37I/AAAAAAAAAEI/YY9lCjLMvaA/s72-c/clip_image002%5B4%5D_thumb%5B5%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2010/06/docx-version-1009.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-5056581772346219</guid><pubDate>Fri, 28 May 2010 14:37:00 +0000</pubDate><atom:updated>2010-06-28T07:38:59.632-07:00</atom:updated><title>DocX and Tables</title><description>&lt;p&gt;Create and inserting Tables into documents is easy with DocX.&lt;/p&gt;  &lt;div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f2faa4e6-a952-4bc4-85f0-05dcf104c857" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: 1px solid rgb(0, 0, 128); color: rgb(0, 0, 0); font-family: 'Courier New',Courier,Monospace; font-size: 10pt;"&gt; &lt;div style="background: none repeat scroll 0% 0% rgb(0, 0, 128); color: rgb(255, 255, 255); font-family: Verdana,Tahoma,Arial,sans-serif; font-weight: bold; padding: 2px 5px;"&gt;Simple Table&lt;/div&gt; &lt;div style="background: none repeat scroll 0% 0% rgb(221, 221, 221); overflow: auto;"&gt; &lt;ol style="background: none repeat scroll 0% 0% rgb(255, 255, 255); margin: 0pt 0pt 0pt 2.5em; padding: 0pt 0pt 0pt 5px; white-space: nowrap;"&gt; &lt;li&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;// Create a document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt; document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Test.docx"&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Add a Table to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;Table&lt;/span&gt; t = document.AddTable(2, 3);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Specify some properties for this Table.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    t.Alignment = &lt;span style="color: rgb(43, 145, 175);"&gt;Alignment&lt;/span&gt;.center;&lt;/li&gt; &lt;li&gt;    t.Design = &lt;span style="color: rgb(43, 145, 175);"&gt;TableDesign&lt;/span&gt;.MediumGrid1Accent2;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt; &lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Add content to this Table.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    t.Rows[0].Cells[0].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"A"&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;    t.Rows[0].Cells[1].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"B"&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    t.Rows[0].Cells[2].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"C"&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;    t.Rows[1].Cells[0].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"D"&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    t.Rows[1].Cells[1].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"E"&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;    t.Rows[1].Cells[2].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"F"&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt; &lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Insert the Table into the document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    document.InsertTable(t);&lt;/li&gt; &lt;li&gt; &lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    document.Save();&lt;/li&gt; &lt;li&gt;}&lt;span style="color: rgb(0, 128, 0);"&gt;// Release this document from memory.&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The above code will creates a document that looks like the below image.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/TCizucsHixI/AAAAAAAAAFc/UVMx7-FaL50/s1600-h/Untitled%5B3%5D.png"&gt;&lt;img style="border: 0px none; display: inline;" title="Untitled" alt="Untitled" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/TCizuz5WmlI/AAAAAAAAAFg/BnY8NWoVF1g/Untitled_thumb%5B1%5D.png?imgmax=800" border="0" height="128" width="486" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Paragraphs inside Table Cells can of course contain content such as Images, Hyperlinks and custom text styles as in the below example.&lt;/p&gt;  &lt;p&gt;   &lt;/p&gt;&lt;div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4d985d82-8a97-4f76-aba5-d0b944f65df9" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: 1px solid rgb(0, 0, 128); color: rgb(0, 0, 0); font-family: 'Courier New',Courier,Monospace; font-size: 10pt;"&gt; &lt;div style="background: none repeat scroll 0% 0% rgb(0, 0, 128); color: rgb(255, 255, 255); font-family: Verdana,Tahoma,Arial,sans-serif; font-weight: bold; padding: 2px 5px;"&gt;Advance Table&lt;/div&gt; &lt;div style="background: none repeat scroll 0% 0% rgb(221, 221, 221); overflow: auto;"&gt; &lt;ol style="background: none repeat scroll 0% 0% rgb(255, 255, 255); margin: 0pt 0pt 0pt 2.5em; padding: 0pt 0pt 0pt 5px; white-space: nowrap;"&gt; &lt;li&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;// Create a document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt; document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Test.docx"&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Add a Table to this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;Table&lt;/span&gt; table = document.AddTable(2, 3);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt; &lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Add a Hyperlink into this document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;Hyperlink&lt;/span&gt; h = document.AddHyperlink(&lt;span style="color: rgb(163, 21, 21);"&gt;"Google"&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Uri&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"http://www.google.com"&lt;/span&gt;));&lt;/li&gt; &lt;li&gt; &lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Add an Image into this document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    Novacode.&lt;span style="color: rgb(43, 145, 175);"&gt;Image&lt;/span&gt; i = document.AddImage(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Logo.png"&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt; &lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Create a Picture (Custom View) of this Image.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;Picture&lt;/span&gt; p = i.CreatePicture();&lt;/li&gt; &lt;li&gt;    p.Rotation = 10;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt; &lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Specify some properties for this Table.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    table.Alignment = &lt;span style="color: rgb(43, 145, 175);"&gt;Alignment&lt;/span&gt;.center;&lt;/li&gt; &lt;li&gt;    table.Design = &lt;span style="color: rgb(43, 145, 175);"&gt;TableDesign&lt;/span&gt;.LightShadingAccent2;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt; &lt;/li&gt; &lt;li&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Insert the Table into the document.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;Table&lt;/span&gt; t1 = document.InsertTable(table);&lt;/li&gt; &lt;li&gt; &lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;// Add content to this Table.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;    t1.Rows[0].Cells[0].Paragraphs.First().AppendHyperlink(h).Append(&lt;span style="color: rgb(163, 21, 21);"&gt;" is my favourite search engine."&lt;/span&gt;);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    t1.Rows[0].Cells[1].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"This text is bold."&lt;/span&gt;).Bold();&lt;/li&gt; &lt;li&gt;    t1.Rows[0].Cells[2].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"Underlined"&lt;/span&gt;).UnderlineStyle(&lt;span style="color: rgb(43, 145, 175);"&gt;UnderlineStyle&lt;/span&gt;.singleLine);&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    t1.Rows[1].Cells[0].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"Green"&lt;/span&gt;).Color(&lt;span style="color: rgb(43, 145, 175);"&gt;Color&lt;/span&gt;.Green);&lt;/li&gt; &lt;li&gt;    t1.Rows[1].Cells[1].Paragraphs.First().Append(&lt;span style="color: rgb(163, 21, 21);"&gt;"Right to Left"&lt;/span&gt;).Direction = &lt;span style="color: rgb(43, 145, 175);"&gt;Direction&lt;/span&gt;.RightToLeft;&lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    t1.Rows[1].Cells[2].Paragraphs.First().AppendPicture(p);&lt;/li&gt; &lt;li&gt; &lt;/li&gt; &lt;li style="background: none repeat scroll 0% 0% rgb(243, 243, 243);"&gt;    document.Save();&lt;/li&gt; &lt;li&gt;}&lt;span style="color: rgb(0, 128, 0);"&gt;// Release this document from memory.&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The above code will creates a document that looks like the below image.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/TCizvYcKnvI/AAAAAAAAAFk/h4yzJVJKdbc/s1600-h/Untitled2%5B4%5D.png"&gt;&lt;img style="border: 0px none; display: inline;" title="Untitled2" alt="Untitled2" src="http://lh4.ggpht.com/_3lwcqZZH2Ts/TCizvwa08NI/AAAAAAAAAFo/t4b-c9rJbGA/Untitled2_thumb%5B2%5D.png?imgmax=800" border="0" height="182" width="514" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Happy coding,  &lt;br /&gt;Cathal&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-5056581772346219?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TPixn0z3riEjpGS3sYbdcy02Acw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TPixn0z3riEjpGS3sYbdcy02Acw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TPixn0z3riEjpGS3sYbdcy02Acw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TPixn0z3riEjpGS3sYbdcy02Acw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/frBjGT7JE74" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/frBjGT7JE74/docx-and-tables.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh6.ggpht.com/_3lwcqZZH2Ts/TCizuz5WmlI/AAAAAAAAAFg/BnY8NWoVF1g/s72-c/Untitled_thumb%5B1%5D.png?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2010/06/docx-and-tables.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-4232157125896656810</guid><pubDate>Thu, 10 Dec 2009 15:26:00 +0000</pubDate><atom:updated>2010-06-08T05:04:20.243-07:00</atom:updated><title>Is DocX dead?</title><description>&lt;p&gt;DocX is not dead. I have just returned to college to finish the fourth and final year of my (computer science and software engineering degree). At the moment because of lectures, assignments, and my final year project, I have very little time to contribute to DocX. I am still answering questions that people email me, but I cannot release a new version of DocX until my exams are finished in June. I have received a lot of emails lately requesting new features for DocX and I am maintaining a priority list of these, I will work off this list in June.&lt;/p&gt;  &lt;p&gt;In case you are interested, below is some information about my final year project.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Project title:&lt;/strong&gt; Real time, naked hand tracking with minimal calibration.   &lt;br /&gt;&lt;strong&gt;Overview:&lt;/strong&gt; My project aims to answer the following question. Can a users hands be reliably tracked in real time from a video sequence without using markers, gloves or electronic devices? &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/SyETFGuSWoI/AAAAAAAAADk/q9NBT7T-1sE/s1600-h/Hands%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Hands" border="0" alt="Hands" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/SyETFhHmlHI/AAAAAAAAADo/Og9BvL6u5fQ/Hands_thumb%5B1%5D.jpg?imgmax=800" width="503" height="215" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;It is now December and I have been working on this problem since September, I have had a lot of success in these 4 short months.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/SyETGFEmVeI/AAAAAAAAADs/OQFGH_5IUag/s1600-h/untitled22%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="untitled22" border="0" alt="untitled22" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/SyETGVV7q2I/AAAAAAAAADw/2d2ApktOyXU/untitled22_thumb%5B2%5D.jpg?imgmax=800" width="563" height="224" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At this point in time I am building example applications to demonstrate my projects use. I am easily able to extract two very useful pieces of information, the distance between my hands and the angle. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/SyETG7yvWRI/AAAAAAAAAD0/I2JxULvKygY/s1600-h/untitled222%5B3%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="untitled222" border="0" alt="untitled222" src="http://lh3.ggpht.com/_3lwcqZZH2Ts/SyETHU9c1bI/AAAAAAAAAD4/c3KamGb3jxE/untitled222_thumb%5B1%5D.jpg?imgmax=800" width="552" height="453" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Here is a video of what I have so far. The change in distance d and angle a between my hands controls the zoom and rotation of the teapot.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p&gt;Let me know what you think,  &lt;br /&gt;Cathal&lt;/p&gt;  &lt;div style="text-align: center;"&gt;&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-5db82c16021b0007" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;
&lt;param name="bgcolor" value="#FFFFFF"&gt;
&lt;param name="allowfullscreen" value="true"&gt;
&lt;param name="flashvars" value="flvurl=http://v8.nonxt5.googlevideo.com/videoplayback?id%3D5db82c16021b0007%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1332330152%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D2DE45BE9AA1453F19B4F4EB2DF22A007EFB1D24F.317CC0119233DF55DACA62C194DFAF520E53F474%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D5db82c16021b0007%26offsetms%3D5000%26itag%3Dw160%26sigh%3DRwqnRHqtPc64xFiVr4u_6acB74o&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;
&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"
width="320" height="266" bgcolor="#FFFFFF"
flashvars="flvurl=http://v8.nonxt5.googlevideo.com/videoplayback?id%3D5db82c16021b0007%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1332330152%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D2DE45BE9AA1453F19B4F4EB2DF22A007EFB1D24F.317CC0119233DF55DACA62C194DFAF520E53F474%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D5db82c16021b0007%26offsetms%3D5000%26itag%3Dw160%26sigh%3DRwqnRHqtPc64xFiVr4u_6acB74o&amp;autoplay=0&amp;ps=blogger"
allowFullScreen="true" /&gt;&lt;/object&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-4232157125896656810?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8rSOUJiXg8_MxZ9xbXmE5nB-9VA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8rSOUJiXg8_MxZ9xbXmE5nB-9VA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8rSOUJiXg8_MxZ9xbXmE5nB-9VA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8rSOUJiXg8_MxZ9xbXmE5nB-9VA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/NLu0gxO-NKI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/NLu0gxO-NKI/is-docx-dead.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh6.ggpht.com/_3lwcqZZH2Ts/SyETFhHmlHI/AAAAAAAAADo/Og9BvL6u5fQ/s72-c/Hands_thumb%5B1%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><enclosure url="http://www.youtube.com/get_player" length="2878" type="application/x-shockwave-flash" /><media:content url="http://www.youtube.com/get_player" fileSize="2878" type="application/x-shockwave-flash" /><feedburner:origLink>http://cathalscorner.blogspot.com/2009/12/is-docx-dead.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-2226637816287090679</guid><pubDate>Sat, 31 Oct 2009 13:21:00 +0000</pubDate><atom:updated>2009-10-31T06:21:11.525-07:00</atom:updated><title>Converting .docx into (.doc, .pdf, .html)</title><description>&lt;h4&gt;Introduction&lt;/h4&gt;  &lt;p&gt;A DocX user asked me during the week when was I going to support converting Word 2007 documents (.docx) into other useful forms such as&amp;#160; (.doc, .pdf, .html). I would love to add this functionality to DocX, however there is a problem.&lt;/p&gt;  &lt;h4&gt;The Problem&lt;/h4&gt;  &lt;p&gt;The only easy way to do this conversion, is to use Microsoft’s Office interop libraries. For anyone who doesn't know what Microsoft’s Office interop libraries are, I envy you.&lt;/p&gt;  &lt;p&gt;The Microsoft Office interop libraries are available in the Add Reference dialog.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/Suw5r88x4qI/AAAAAAAAACw/FjB4uQLYxx8/s1600-h/Untitled3.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled" border="0" alt="Untitled" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/Suw5scJAwbI/AAAAAAAAAC0/Xz--nsgfMdE/Untitled_thumb1.jpg?imgmax=800" width="596" height="290" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;The Code&lt;/h4&gt;  &lt;p&gt;Once you have added a reference to Microsoft.Office.Interop.Word you can use the below project to convert a Word 2007 .docx into .doc, .pdf, and .html.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7ae90fbd-1130-4fbb-ac28-2154bba850f3" class="wlWriterEditableSmartContent"&gt; &lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt; &lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; Word = Microsoft.Office.Interop.Word;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;using&lt;/span&gt; Microsoft.Office.Interop.Word;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;namespace&lt;/span&gt; ConsoleApplication1&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Program&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Convert Input.docx into Output.doc&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Convert(&lt;span style="color:#a31515"&gt;@&amp;quot;C:&amp;#92;users&amp;#92;cathal&amp;#92;Desktop&amp;#92;Input.docx&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;@&amp;quot;c:&amp;#92;users&amp;#92;cathal&amp;#92;Desktop&amp;#92;Output.doc&amp;quot;&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;WdSaveFormat&lt;/span&gt;.wdFormatDocument);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;/* &lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;* Convert Input.docx into Output.pdf&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;* Please note: You must have the Microsoft Office 2007 Add-in: Microsoft Save as PDF or XPS installed&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;* http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&amp;amp;displaylang=en&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;*/&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Convert(&lt;span style="color:#a31515"&gt;@&amp;quot;c:&amp;#92;users&amp;#92;cathal&amp;#92;Desktop&amp;#92;Input.docx&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;@&amp;quot;c:&amp;#92;users&amp;#92;cathal&amp;#92;Desktop&amp;#92;Output.pdf&amp;quot;&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;WdSaveFormat&lt;/span&gt;.wdFormatPDF);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Convert Input.docx into Output.html&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Convert(&lt;span style="color:#a31515"&gt;@&amp;quot;c:&amp;#92;users&amp;#92;cathal&amp;#92;Desktop&amp;#92;Input.docx&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;@&amp;quot;c:&amp;#92;users&amp;#92;cathal&amp;#92;Desktop&amp;#92;Output.html&amp;quot;&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;WdSaveFormat&lt;/span&gt;.wdFormatHTML);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Convert a Word 2008 .docx to Word 2003 .doc&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Convert(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; input, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; output, &lt;span style="color:#2b91af"&gt;WdSaveFormat&lt;/span&gt; format)&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Create an instance of Word.exe&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Word.&lt;span style="color:#2b91af"&gt;_Application&lt;/span&gt; oWord = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; Word.&lt;span style="color:#2b91af"&gt;Application&lt;/span&gt;();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Make this instance of word invisible (Can still see it in the taskmgr).&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;oWord.Visible = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Interop requires objects.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; oMissing = System.Reflection.&lt;span style="color:#2b91af"&gt;Missing&lt;/span&gt;.Value;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; isVisible = &lt;span style="color:#0000ff"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; readOnly = &lt;span style="color:#0000ff"&gt;false&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; oInput = input;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; oOutput = output;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; oFormat = format;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Load a document into our instance of word.exe&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Word.&lt;span style="color:#2b91af"&gt;_Document&lt;/span&gt; oDoc = oWord.Documents.Open(&lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oInput, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; readOnly, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; isVisible, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing);&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Make this document the active document.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;oDoc.Activate();&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Save this document in Word 2003 format.&lt;/span&gt;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;oDoc.SaveAs(&lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oOutput, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oFormat, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000"&gt;// Always close Word.exe.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;oWord.Quit(&lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing, &lt;span style="color:#0000ff"&gt;ref&lt;/span&gt; oMissing);&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;h4 align="left"&gt;The result&lt;/h4&gt;  &lt;div align="center"&gt;   &lt;table border="0" cellspacing="0" cellpadding="2" width="400" align="center"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="133"&gt;&amp;#160;&lt;/td&gt;          &lt;td valign="top" width="133"&gt;           &lt;p align="center"&gt;&lt;a href="http://lh3.ggpht.com/_3lwcqZZH2Ts/Suw5swcj4kI/AAAAAAAAAC4/JPumdYtmduk/s1600-h/image%5B8%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_3lwcqZZH2Ts/Suw5tSESIhI/AAAAAAAAAC8/D5dfHm9l87Q/image_thumb%5B5%5D.png?imgmax=800" width="117" height="117" /&gt;&lt;/a&gt;               &lt;br /&gt;&lt;strong&gt;Input.docx&lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="133"&gt;&amp;#160;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="133"&gt;           &lt;p align="center"&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/Suw5tw6903I/AAAAAAAAADA/PwggKnoYXXk/s1600-h/image%5B9%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_3lwcqZZH2Ts/Suw5ue9X1FI/AAAAAAAAADE/cPm0RL5wSz8/image_thumb%5B6%5D.png?imgmax=800" width="139" height="132" /&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="133"&gt;           &lt;p align="center"&gt;&lt;a href="http://lh4.ggpht.com/_3lwcqZZH2Ts/Suw5umjBPcI/AAAAAAAAADI/azcisaqovNY/s1600-h/image%5B17%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/Suw5vJApFnI/AAAAAAAAADM/wb95HVUsmV8/image_thumb%5B14%5D.png?imgmax=800" width="139" height="134" /&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="133"&gt;           &lt;p align="center"&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/Suw5v0KZkOI/AAAAAAAAADQ/Jnyu-UtOpQQ/s1600-h/image%5B18%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_3lwcqZZH2Ts/Suw5wAw38fI/AAAAAAAAADU/lektxVI5OB8/image_thumb%5B15%5D.png?imgmax=800" width="114" height="136" /&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="133"&gt;           &lt;p align="center"&gt;&lt;strong&gt;Output.doc&lt;/strong&gt; &lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="133"&gt;           &lt;p align="center"&gt;&lt;strong&gt;Output.pdf&lt;/strong&gt; &lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="133"&gt;           &lt;p align="center"&gt;&lt;strong&gt;Output.html&lt;/strong&gt; &lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt;  &lt;h4&gt;Please note&lt;/h4&gt;  &lt;p&gt;This code will only execute on a machine that has Microsoft’s Office installed on it. The Microsoft’s Office interop libraries actually execute a “hidden” instance of the Office. If you run the above code and then take a look at taskmgr you will see the following.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_3lwcqZZH2Ts/Suw5w9k_gLI/AAAAAAAAADY/gH0JFCL8z94/s1600-h/image3.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_3lwcqZZH2Ts/Suw5xrIAXmI/AAAAAAAAADc/ntnIQTx9kxQ/image_thumb1.png?imgmax=800" width="312" height="241" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If you want to convert to .pdf, you must also have the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&amp;amp;displaylang=en"&gt;Microsoft Office 2007 Add-in: Microsoft Save as PDF or XPS&lt;/a&gt; installed.&lt;/p&gt;  &lt;p&gt;It is for this reason that I have not included convert functionality into my DocX library. I do not want DocX to have a dependency on Word.exe.&lt;/p&gt;  &lt;h4&gt;The future&lt;/h4&gt;  &lt;p&gt;Is there no way to do conversions without having Word.exe installed on my machine. I didn’t say that, I said there is no easy way. &lt;a href="http://stackoverflow.com/questions/285700/programatically-convert-word-docx-to-doc-without-using-ole-automation"&gt;This&lt;/a&gt; looks very promising, now if I could only find the time.&lt;/p&gt;  &lt;h4&gt;Donation?&lt;/h4&gt;  &lt;p&gt;As always, I offer this code to you for free. I am however a student and if you would like to say thank you, you can buy me lunch by sending a €5 euro &lt;a href="https://www.paypal.com/uk/cgi-bin/webscr?cmd=_flow&amp;amp;SESSION=qrABNTwb31m8fW-Ukdrv2ayfivpa7QOs1p5RflB6-GKn3IsgiN7fpmr54Lm&amp;amp;dispatch=5885d80a13c0db1ffc45dc241d84e9538c532da79baccf7c1009429e47706c4e"&gt;donation&lt;/a&gt; via paypal.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-2226637816287090679?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/eZ50B7YClEvzhZPK-dKcbjHCXD4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eZ50B7YClEvzhZPK-dKcbjHCXD4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/eZ50B7YClEvzhZPK-dKcbjHCXD4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eZ50B7YClEvzhZPK-dKcbjHCXD4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/j4w48znOsHA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/j4w48znOsHA/converting-docx-into-doc-pdf-html.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh6.ggpht.com/_3lwcqZZH2Ts/Suw5scJAwbI/AAAAAAAAAC0/Xz--nsgfMdE/s72-c/Untitled_thumb1.jpg?imgmax=800" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/10/converting-docx-into-doc-pdf-html.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-4877953648699824912</guid><pubDate>Thu, 17 Sep 2009 18:14:00 +0000</pubDate><atom:updated>2009-09-17T11:14:21.592-07:00</atom:updated><title>DocX codeplex page redesign</title><description>&lt;p&gt;I have spent some time over the past few days redesigning &lt;a href="http://docx.codeplex.com"&gt;http://docx.codeplex.com&lt;/a&gt;. I have decided to go with a minimalistic design, my girlfriend &lt;a href="http://cristinaluminea.blogspot.com/"&gt;Cristina&lt;/a&gt; who created all of the art work for me, told me that I should not be afraid of white space. I think she's on to something.&lt;/p&gt;  &lt;p&gt;The biggest addition to the new page design is a section aptly named “How do I learn more?”. It is my intention to upload a large series of video tutorials to this section, I have already uploaded the first two.&lt;/p&gt;  &lt;p&gt;1. Getting started with DocX.   &lt;br /&gt;2. Paragraphs and text formatting.&lt;/p&gt;  &lt;p&gt;If you have any requests, topics that you would like to see covered, please send them to &lt;a href="mailto:coffey.cathal@gmail.com"&gt;coffey.cathal@gmail.com&lt;/a&gt;. I am definitely going to create a video about CustomProperties, and another about Images and Pictures. I would also welcome feedback about the new page design, both positive and negative.&lt;/p&gt;  &lt;p&gt;Kind regards and happy coding,   &lt;br /&gt;Cathal&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-4877953648699824912?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Lx7lochD-wQRc1hYnhEaDk1_93k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Lx7lochD-wQRc1hYnhEaDk1_93k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Lx7lochD-wQRc1hYnhEaDk1_93k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Lx7lochD-wQRc1hYnhEaDk1_93k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/6TNYsKouhwg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/6TNYsKouhwg/docx-codeplex-page-redesign.html</link><author>noreply@blogger.com (Cathal Coffey)</author><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/09/docx-codeplex-page-redesign.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-8595739292172917431</guid><pubDate>Fri, 28 Aug 2009 15:35:00 +0000</pubDate><atom:updated>2009-08-28T10:36:40.697-07:00</atom:updated><title>DocX v1.0.0.8 released</title><description>&lt;span style="color: rgb(51,51,51);font-size:small;" class="Apple-style-span"&gt; &lt;div  style="display: block; color: rgb(102,102,102); margin-left: 0.2emfont-size:17px;" id="previewbody"&gt;&lt;span style="line-height: 20px; color: rgb(51,51,51)" class="Apple-style-span"&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;DocX version 1.0.0.8 is now available for download from &lt;/span&gt;&lt;/span&gt;&lt;a href="http://docx.codeplex.com/"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;here&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;. So what's new in this version? Why should you download it?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt; &lt;div  style="display: block; color: rgb(102,102,102); margin-left: 0.2emfont-size:17px;" id="previewbody"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;The biggest addition to this version of DocX is a better method of building highly formatted Paragraphs. This new method is a fluent interface and it was proposed by one of DocX's users &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Morten Bjerre&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;. So what is a fluent interface? This Wikipedia &lt;/span&gt;&lt;/span&gt;&lt;a href="http://en.wikipedia.org/wiki/Fluent_interface"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;article&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; explains fluent interfaces quite well.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;div  style="display: block; color: rgb(102,102,102); margin-left: 0.2emfont-size:17px;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Here is an example of how this new addition to DocX makes building highly formatted Paragraphs easier and more intuitive. Lets say that we want to create a document that looks like this.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt; &lt;div  style="display: block; color: rgb(102,102,102); margin-left: 0.2emfont-size:17px;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://lh6.ggpht.com/_3lwcqZZH2Ts/SpgL0yfSqAI/AAAAAAAAACA/S3rFkXsu0x8/s1600-h/Untitled%5B7%5D.png"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Untitled" border="0" alt="Untitled" src="http://lh5.ggpht.com/_3lwcqZZH2Ts/SpgL1h2WCHI/AAAAAAAAACE/3zz5R2DF2CY/Untitled_thumb%5B3%5D.png?imgmax=800" width="337" height="183" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;This can now be accomplished with the below code.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;div  style="display: block; color: rgb(102,102,102); margin-left: 0.2emfont-size:17px;" id="previewbody"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre class="code"&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;/ Create a document.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;DocX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;document = &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;DocX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.Create(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;@"Test.docx"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;))&lt;br /&gt;{&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;// Insert a new Paragraphs.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Paragraph &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;p = document.InsertParagraph();&lt;br /&gt;&lt;br /&gt; p.Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"I am "&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;).Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"bold"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;).Bold()&lt;br /&gt; .Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;" and I am "&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)&lt;br /&gt; .Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"italic"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;).Italic().Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"."&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)&lt;br /&gt; .AppendLine(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"I am "&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)&lt;br /&gt; .Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"Arial Black"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)&lt;br /&gt; .Font(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;FontFamily&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"Arial Black"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;))&lt;br /&gt; .Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;" and I am not."&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)&lt;br /&gt; .AppendLine(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"I am "&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)&lt;br /&gt; .Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"BLUE"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;).Color(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Color&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.Blue)&lt;br /&gt; .Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;" and I am"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)&lt;br /&gt; .Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"Red"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;).Color(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Color&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.Red).Append(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"."&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;);&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;// Save this document.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;document.Save();&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;// Release this document from memory.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;hr /&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;This version of DocX also contains three new features that were added by a user &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Joel Folkerts&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;. Joel is the first user to post working and tested code for inclusion in DocX. These new features are listed below.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;1. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Row.Height property&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;2. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Cell.Width property&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;3. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Row.MergeCells&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Row.Height and Cell.Width are self explanatory but here is an example of using Row.MergeCells. Lets say we have the following Table.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/SpgL3K5gWEI/AAAAAAAAACI/RoEghtE16AE/s1600-h/Untitled%5B3%5D.png"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/pre&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/SpgL3K5gWEI/AAAAAAAAACI/RoEghtE16AE/s1600-h/Untitled%5B3%5D.png"&gt;&lt;span style="color:#000000;"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled" border="0" alt="Untitled" src="http://lh6.ggpht.com/_3lwcqZZH2Ts/SpgL3yA-fWI/AAAAAAAAACM/sdC7Zj2s9rw/Untitled_thumb%5B1%5D.png?imgmax=800" width="384" height="76" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;We can merge the cells {1-3} and the cells {6-8} on row 1 to get the following table.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;a href="http://lh5.ggpht.com/_3lwcqZZH2Ts/SpgL4NTMJbI/AAAAAAAAACQ/EvQ56PtNZn8/s1600-h/Untitled3%5B4%5D.png"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled3" border="0" alt="Untitled3" src="http://lh5.ggpht.com/_3lwcqZZH2Ts/SpgL4gvqfDI/AAAAAAAAACU/9RkDhxDhcg8/Untitled3_thumb%5B2%5D.png?imgmax=800" width="370" height="112" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;This can now be accomplished in DocX with the following code.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre class="code"&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Load a document.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;DocX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;document = &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;DocX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.Load(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;@"Test.docx"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;))&lt;br /&gt;{&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Grab the first Table.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Table &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;t = document.Tables[0];&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Grab the first Row of this Table.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Row &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;r = t.Rows[1];&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Merge the cells 1-3 into one new cell.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;r.MergeCells(1, 3);&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Merge the cells 4-6&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;r.MergeCells(4, 6);&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Save all changes made to this document.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;document.Save();&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Release this document from memory.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;hr /&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;I have also added a new feature that was requested by a user Mathetes. This new feature allows TextReplace() to take a Formatting object as an extra parameter and it then only returns text that matches both the input string and that format. Another new extra parameter for this function is  a new Formatting object to be applied to the inserted text.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Load a document.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;using &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;DocX &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;document = &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;DocX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.Load(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;@"Test.docx"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;))&lt;br /&gt;{&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// The formatting to match.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Formatting &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;matchFormatting = &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Formatting&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;();&lt;br /&gt; matchFormatting.Size = 10;&lt;br /&gt; matchFormatting.Italic = &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;;&lt;br /&gt; matchFormatting.FontFamily =&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;FontFamily&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;"Times New Roman"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;);&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// The new formatting to apply.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Formatting &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;newFormatting = &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;new &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Formatting&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;();&lt;br /&gt; newFormatting.Size = 22;&lt;br /&gt; newFormatting.UnderlineStyle =&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;UnderlineStyle&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.dotted;&lt;br /&gt; newFormatting.Bold = &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Iterate through the paragraphs&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;foreach &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Paragraph &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;p &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;in &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;document.Paragraphs)&lt;br /&gt; {&lt;br /&gt;      p.ReplaceText&lt;br /&gt;      (&lt;br /&gt;          &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;"wrong"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;"right"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;,&lt;br /&gt;          &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;RegexOptions&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.IgnoreCase,&lt;br /&gt;          newFormatting, matchFormatting,&lt;br /&gt;          &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#2b91af;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;MatchFormattingOptions&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;.SubsetMatch&lt;br /&gt;       );&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Save all changes made to this document.&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;document.Save();&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;// Release this document from memory.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span&gt;&lt;span style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span style="color:green;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;I want to take this opportunity to say a huge thank you to Morten Bjerre, Joel Folkerts and Mathetes. You have all enhanced DocX greatly with the features that you have added to this version.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;If anyone out there reading this wants to suggest a new feature, please send it my way. I will try my best to include it in a future version for DocX.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;pre class="code"&gt;&lt;span style="color: rgb(51,51,51)" class="Apple-style-span"&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;happy coding,&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="color:#000000;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Cathal&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-8595739292172917431?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iR8FZ4vYdhkRWVsHyPuAhvRswGw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iR8FZ4vYdhkRWVsHyPuAhvRswGw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iR8FZ4vYdhkRWVsHyPuAhvRswGw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iR8FZ4vYdhkRWVsHyPuAhvRswGw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/TKe031E1kbg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/TKe031E1kbg/docx-v1008-released.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://lh5.ggpht.com/_3lwcqZZH2Ts/SpgL1h2WCHI/AAAAAAAAACE/3zz5R2DF2CY/s72-c/Untitled_thumb%5B3%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/08/docx-v1008-released.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-9132547659961431055</guid><pubDate>Sat, 15 Aug 2009 01:34:00 +0000</pubDate><atom:updated>2009-08-25T07:07:08.209-07:00</atom:updated><title>DocX v1.0.0.7 released</title><description>I have just uploaded DocX version 1.0.0.7 to &lt;a href="http://docx.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=31554" target="_blank"&gt;docx.codeplex.com&lt;/a&gt;. This version comes with an extra optional download “Advance – Invoice Example.zip”.&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3lwcqZZH2Ts/SpPvCMh08sI/AAAAAAAAAAc/8CAvBIBcD5A/s1600-h/y1mBiX1s7kC-_slvhYdloxI9A9dZt_uXbyKvIvE7QzzjaY35Of8v930J-0XJHEz8O5kWb-lrRS21TS-qoz8Mb3Yg_XxXAE-lElMrkwedBlpse_3jXfTSRy2jZBoh7dsruDTW2Ra2FFsN1VxJIilwDuPhQ.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 381px; height: 203px;" src="http://2.bp.blogspot.com/_3lwcqZZH2Ts/SpPvCMh08sI/AAAAAAAAAAc/8CAvBIBcD5A/s400/y1mBiX1s7kC-_slvhYdloxI9A9dZt_uXbyKvIvE7QzzjaY35Of8v930J-0XJHEz8O5kWb-lrRS21TS-qoz8Mb3Yg_XxXAE-lElMrkwedBlpse_3jXfTSRy2jZBoh7dsruDTW2Ra2FFsN1VxJIilwDuPhQ.png" alt="" id="BLOGGER_PHOTO_ID_5373901601385018050" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="https://oa9p8g.bay.livefilestore.com/y1mNdQrw6qY4UMu-mfPdA5ePtOuMSFGaizKz2Jlq6YhAKZSdvuYJeQMbjOnip7fzVylt9MqlDSaBZqV_3UNtrKYdvOwWzeZcKpIw9N2uwZMQWO9lV7vJqihf1YtS-vWrnAm-DqRImTc4jMGvGm7naSDMA/image%5B6%5D.png" rel="WLPP"&gt;&lt;/a&gt;  &lt;p&gt;“Advance – Invoice Example.zip” is a zipped Visual Studio 2008 solution that I created to demonstrate how far DocX has evolved since version 1.0.0.1. The first time that you run InvoiceExample.exe it will check for the existence of a document called “InvoiceTemplate.docx”, because this is the first execution this document will not exist, so it is created.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3lwcqZZH2Ts/SpPukU9axxI/AAAAAAAAAAM/kQwdhYeEu5s/s1600-h/y1mKDODx7pZLQzpVKhQfvwCbjBTTqQvTM4xOABoZYPX4Mg_tkb8M3VZKOFt2vAfIE3d7OQJ7JW4mVHywMWCMmQetVE2LsH82mSHZobJwq2Gepp0QuXcU8pDQdOz4Zy6KXKikUMb7KeRUSIlCmlnZmIgGA.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 211px;" src="http://1.bp.blogspot.com/_3lwcqZZH2Ts/SpPukU9axxI/AAAAAAAAAAM/kQwdhYeEu5s/s400/y1mKDODx7pZLQzpVKhQfvwCbjBTTqQvTM4xOABoZYPX4Mg_tkb8M3VZKOFt2vAfIE3d7OQJ7JW4mVHywMWCMmQetVE2LsH82mSHZobJwq2Gepp0QuXcU8pDQdOz4Zy6KXKikUMb7KeRUSIlCmlnZmIgGA.png" alt="" id="BLOGGER_PHOTO_ID_5373901088252151570" border="0" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p align="center"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.0 - InvoiceTemplate.docx created by first run of InvoiceExample.exe&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;It is important to note that everything you see in the above screenshot was created by DocX. If you now run InvoiceExample.exe again the document “InvoiceTemplate.docx” is found and it is now used to create an invoice for a factitious company called “The Happy Builder”.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3lwcqZZH2Ts/SpPuzgAPESI/AAAAAAAAAAU/VWf66oVO3ZA/s1600-h/y1m82hozF2hfOR_jiSfMz7dbWWwsRPULwnBRD-RakfkglmdILqtDI3KGwoAnqhyuuL1O5Ne5kOmt8SFGHtXs5SBhUGtGRXauMKJLnaiLLvbQr7AlZkZ-6BzCgv0PykXjj_TbJxbu3w1cSuvA6G2t43h4A.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 260px;" src="http://3.bp.blogspot.com/_3lwcqZZH2Ts/SpPuzgAPESI/AAAAAAAAAAU/VWf66oVO3ZA/s400/y1m82hozF2hfOR_jiSfMz7dbWWwsRPULwnBRD-RakfkglmdILqtDI3KGwoAnqhyuuL1O5Ne5kOmt8SFGHtXs5SBhUGtGRXauMKJLnaiLLvbQr7AlZkZ-6BzCgv0PykXjj_TbJxbu3w1cSuvA6G2t43h4A.png" alt="" id="BLOGGER_PHOTO_ID_5373901348914794786" border="0" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p align="center"&gt; &lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.1 - Invoice_The_Happy_Builder.docx created by second run of InvoiceExample.exe&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;As you can see DocX has loaded the document “InvoiceTemplate.docx” into memory and customized it. This was done by setting &lt;strong&gt;custom property&lt;/strong&gt; values, inserting an i&lt;strong&gt;mage, &lt;/strong&gt;creating a &lt;strong&gt;picture&lt;/strong&gt; from this image, and replacing a Table with a new Table that contains data from a data source.&lt;/p&gt; &lt;p&gt;This example is intended for an experienced user of DocX. A first time user may find this solution overwhelming. Over the next few days, I am going to create a video tutorial called "Getting started with DocX". This video will be targeted at the first time user of DocX.&lt;/p&gt; &lt;p&gt;I hope that from this example you can see how quickly Docx is growing and also how useful it is becoming. As always if you would like to report a bug, request a feature or even just say hi, please email me at &lt;a href="mailto:coffey.cathal@gmail.com"&gt;coffey.cathal@gmail.com&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;happy coding,&lt;br /&gt;Cathal&lt;/p&gt; &lt;p&gt;DocX is completely free, but if you have found it useful and you would like to make a &lt;a href="https://www.paypal.com/uk/cgi-bin/webscr?cmd=_flow&amp;amp;SESSION=tPz_kKqEd9KTbzIfHG9E7JZA-MNqLNJa5cwG51BEkg4hTpZm3Zlo3EHhFCK&amp;amp;dispatch=5885d80a13c0db1fb6947b0aeae66fdb090c3508df63c7a01f761c9e563d3d93"&gt;donation&lt;/a&gt; you can do so via paypal.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-9132547659961431055?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IwpYGVF_GHkcE-7ju1k8KUc2vdE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IwpYGVF_GHkcE-7ju1k8KUc2vdE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IwpYGVF_GHkcE-7ju1k8KUc2vdE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IwpYGVF_GHkcE-7ju1k8KUc2vdE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/beae4AZQZUo" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/beae4AZQZUo/docx-v1007-released.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://2.bp.blogspot.com/_3lwcqZZH2Ts/SpPvCMh08sI/AAAAAAAAAAc/8CAvBIBcD5A/s72-c/y1mBiX1s7kC-_slvhYdloxI9A9dZt_uXbyKvIvE7QzzjaY35Of8v930J-0XJHEz8O5kWb-lrRS21TS-qoz8Mb3Yg_XxXAE-lElMrkwedBlpse_3jXfTSRy2jZBoh7dsruDTW2Ra2FFsN1VxJIilwDuPhQ.png" height="72" width="72" /><thr:total>5</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/08/docx-v1007-released.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-3716829853803863034</guid><pubDate>Tue, 04 Aug 2009 07:03:00 +0000</pubDate><atom:updated>2009-08-25T07:14:58.331-07:00</atom:updated><title>DocX version 1.0.0.6 released</title><description>&lt;p&gt;Hi again, sorry it has been so long since my last post. My progress in the physical world has slowed my progress in the digital.&lt;/p&gt; &lt;p&gt;This newest version of DocX brings many bug fixes and also two new features. Firstly, I would like to thank the following people for taking the time to email me with bugs and feature requests. Without your interest and feedback, DocX would not progress.&lt;/p&gt; &lt;p&gt;Many thanks to: John Marsh, Francesco, Johan Laagland, Gaspar, Brian (chicken), Jianbang, Christopher W. Steelman, Peter Thompson, Brian Minert.&lt;/p&gt; &lt;h4&gt;&lt;span style="color: rgb(0, 128, 192);"&gt;New features&lt;/span&gt;&lt;/h4&gt; &lt;p&gt;1) InsertDocProperty(CustomProperty cp)&lt;/p&gt; &lt;p&gt;CustomProperties are displayed in a document using fields of type DocProperty. Until this version, DocX was capable of adding a CustomProperty to a document, but it was not capable of displaying these CustomProperties. As of DocX version 1.0.0.6, this is now possible, below is an example.&lt;/p&gt;  &lt;pre&gt;&lt;span style="color:green;"&gt;// Load a document&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DocX &lt;/span&gt;document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Test.docx"&lt;/span&gt;))&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:green;"&gt;// Create a custom property.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   CustomProperty &lt;/span&gt;name = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"name"&lt;/span&gt;, &lt;span style="color: rgb(163, 21, 21);"&gt;"Cathal Coffey"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;   // Add this custom property to this document.&lt;br /&gt;   &lt;/span&gt;document.AddCustomProperty(name);&lt;br /&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;   // Insert a new paragraph.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    Paragraph &lt;/span&gt;p = document.InsertParagraph(&lt;span style="color: rgb(163, 21, 21);"&gt;"Author: "&lt;/span&gt;, &lt;span style="color:blue;"&gt;false&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;   // Insert a field of type document property to display the custom property name&lt;br /&gt;&lt;/span&gt;   p.InsertDocProperty(name);&lt;br /&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;   // Save all changes made to this document.&lt;br /&gt;&lt;/span&gt;   document.Save();&lt;br /&gt;}&lt;span style="color:green;"&gt;// Release this document from memory.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;The above code example will create the following document. Please note that the text 'Cathal Coffey'&lt;br /&gt;is being displayed by a field, this field's value is controlled by the CustomProperty 'name'.&lt;/pre&gt;&lt;h4 style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3lwcqZZH2Ts/SpPwuYwKXHI/AAAAAAAAAAk/Zw1P3EJG8I0/s1600-h/Untitled.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 329px;" src="http://1.bp.blogspot.com/_3lwcqZZH2Ts/SpPwuYwKXHI/AAAAAAAAAAk/Zw1P3EJG8I0/s400/Untitled.jpg" alt="" id="BLOGGER_PHOTO_ID_5373903460092238962" border="0" /&gt;&lt;/a&gt;&lt;/h4&gt; &lt;pre&gt;2) FindAll(string str)&lt;/pre&gt;&lt;pre&gt;This version of DocX allows you to search a document for a string. The function&lt;br /&gt;FindAll(string str) returns a list containing all of the start indexes of the found string.&lt;br /&gt;Below is an example of this new function.&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:green;"&gt;// Load a document&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DocX &lt;/span&gt;document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Load(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Test.docx"&lt;/span&gt;))&lt;br /&gt;{&lt;br /&gt;  &lt;span style="color:green;"&gt;// Loop through the paragraphs in this document.&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;  foreach &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;Paragraph &lt;/span&gt;p &lt;span style="color:blue;"&gt;in &lt;/span&gt;document.Paragraphs)&lt;br /&gt;  {&lt;br /&gt;    &lt;span style="color:green;"&gt;  // Find all instances of 'go' in this paragraph.&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;  List&lt;/span&gt;&lt;&lt;span style="color:blue;"&gt;int&lt;/span&gt;&gt; gos = document.FindAll(&lt;span style="color: rgb(163, 21, 21);"&gt;"go"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;    &lt;span style="color:green;"&gt;  /*&lt;br /&gt;       * Insert 'don't' in front of every instance of 'go' in this document to produce         * 'don't go'. An important trick here is to do the inserting in reverse document         * order. If you inserted in document order, every insert would shift the index         * of the remaining matches.&lt;br /&gt;       */&lt;br /&gt;    &lt;/span&gt;  gos.Reverse();&lt;br /&gt;    &lt;span style="color:blue;"&gt;  foreach &lt;/span&gt;(&lt;span style="color:blue;"&gt;int &lt;/span&gt;index &lt;span style="color:blue;"&gt;in &lt;/span&gt;gos)&lt;br /&gt;      {&lt;br /&gt;         p.InsertText(index, &lt;span style="color: rgb(163, 21, 21);"&gt;"don't "&lt;/span&gt;, &lt;span style="color:blue;"&gt;true&lt;/span&gt;);&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;  // Save all changes made to this document.&lt;br /&gt;&lt;/span&gt;  document.Save();&lt;br /&gt;}&lt;span style="color:green;"&gt;// Release this document from memory.&lt;/span&gt;&lt;/pre&gt;If the above code is run on this document (Drawing in red is to illustrate the index's of each instance of 'go').&lt;p style="text-align: center;"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mxx0zyihYoSIGoJeNlzvR7bYt1IvQ4Kw_Wj7HifD6GgJVM68NVFjhLuOrur76CBv_zF-ntj04dgVKLNeBzTozuE1qznqtQV3JknjQQQsGvddR2xHilzCsZ7ajV_cSxgyOrKzLiLlKHugdrZ4uMRdMkw/Untitled2.jpg" rel="WLPP;url=https://u8hm0q.bay.livefilestore.com/y1mxx0zyihYoSIGoJeNlzvR7bYt1IvQ4Kw_Wj7HifD6GgJVM68NVFjhLuOrur76CBv_zF-ntj04dgVKLNeBzTozuE1qznqtQV3JknjQQQsGvddR2xHilzCsZ7ajV_cSxgyOrKzLiLlKHugdrZ4uMRdMkw/Untitled2.jpg" target="_blank"&gt;&lt;img alt="" src="https://u8hm0q.bay.livefilestore.com/y1mxx0zyihYoSIGoJeNlzvR7bYt1IvQ4Kw_Wj7HifD6GgJVM68NVFjhLuOrur76CBv_zF-ntj04dgVKLNeBzTozuE1qznqtQV3JknjQQQsGvddR2xHilzCsZ7ajV_cSxgyOrKzLiLlKHugdrZ4uMRdMkw/Untitled2.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Then the following document is produced.&lt;/p&gt;&lt;p style="text-align: center;"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mPUFYxjhE3-ecWsHMT2ef64FLYUqhhVopmuXE51sWN8V5oy2SWQRIhyF_DwJfFaDzqvFQgRO0qJHoNMX4iJ-1fiNONsD9PbkEOO_KmgRLahDJFSZxwtzhWi7-MTs7Ex8dXggQtpZkDokK8jGCPFvb7Q/Untitled3.jpg" rel="WLPP;url=https://u8hm0q.bay.livefilestore.com/y1mPUFYxjhE3-ecWsHMT2ef64FLYUqhhVopmuXE51sWN8V5oy2SWQRIhyF_DwJfFaDzqvFQgRO0qJHoNMX4iJ-1fiNONsD9PbkEOO_KmgRLahDJFSZxwtzhWi7-MTs7Ex8dXggQtpZkDokK8jGCPFvb7Q/Untitled3.jpg" target="_blank"&gt;&lt;img alt="" src="https://u8hm0q.bay.livefilestore.com/y1mPUFYxjhE3-ecWsHMT2ef64FLYUqhhVopmuXE51sWN8V5oy2SWQRIhyF_DwJfFaDzqvFQgRO0qJHoNMX4iJ-1fiNONsD9PbkEOO_KmgRLahDJFSZxwtzhWi7-MTs7Ex8dXggQtpZkDokK8jGCPFvb7Q/Untitled3.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;As you can see, 'don't' was inserted at the original index of each instance of 'go'.&lt;br /&gt;&lt;br /&gt;DocX is completely free, but if you have found it useful and you would like to make a &lt;a href="https://www.paypal.com/uk/cgi-bin/webscr?cmd=_flow&amp;amp;SESSION=tPz_kKqEd9KTbzIfHG9E7JZA-MNqLNJa5cwG51BEkg4hTpZm3Zlo3EHhFCK&amp;amp;dispatch=5885d80a13c0db1fb6947b0aeae66fdb090c3508df63c7a01f761c9e563d3d93" target="_blank"&gt;donation&lt;/a&gt; you can do so via paypal.&lt;/p&gt;As always, please contact me if you find any bugs, have any feature requests or just want to provide feedback.&lt;br /&gt;&lt;p&gt;happy coding,&lt;br /&gt;Cathal&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-3716829853803863034?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/B7g9-RzJhSfT0NEQUP5mF-FNKGQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B7g9-RzJhSfT0NEQUP5mF-FNKGQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/B7g9-RzJhSfT0NEQUP5mF-FNKGQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/B7g9-RzJhSfT0NEQUP5mF-FNKGQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/Uii5PXVqvpY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/Uii5PXVqvpY/docx-version-1006-released.html</link><author>noreply@blogger.com (Cathal Coffey)</author><media:thumbnail url="http://1.bp.blogspot.com/_3lwcqZZH2Ts/SpPwuYwKXHI/AAAAAAAAAAk/Zw1P3EJG8I0/s72-c/Untitled.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/08/docx-version-1006-released.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-7899971228989824052</guid><pubDate>Mon, 20 Apr 2009 03:32:00 +0000</pubDate><atom:updated>2009-08-25T07:17:11.867-07:00</atom:updated><title>DocX version 1.0.0.4 released</title><description>&lt;p&gt;This blog post is to announce the release of DocX version 1.0.0.4. I spend a lot of time re-factoring the library for this release. I have renamed a lot of functions to give a more consistent implementation. I have also created a (.chm) documentation file which contains lots of useful examples. &lt;/p&gt;&lt;p&gt;&lt;span style="color: rgb(0, 128, 192);font-size:100%;" &gt;The .chm documentation&lt;br /&gt;&lt;/span&gt;If you open up the documentation file and you see the message Navigation to the webpage was cancelled like the below screenshot. &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mVQpow_6gOlABIadJwxz9Two5yyo1jQqf_viaDSnYW9kLz_KDeqJrm4dSErjzR9n9whdbAppFlkGYLg8EH_9JID0BhtaDu7l2zrKXj4E8ZIh8Fq9R9wzQajHi3KItTmfZqU2lJuknpcHtd6b2kPhdFw/image%5B23%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mShqpwEm4tNo9GCaQBUk6qnVYzaiwJfchVV79y2Euym0D8_eMbcDbIGoIknRxjU6cBY4aL4XRxJSfNfGc4BW5RmCWfxxd84btSvrP2yXZgFWMkD7Q_ws3ohHWTXqCurK8KxSgMdmpcmIVO4v2OadS6A/image_thumb%5B13%5D%201C8A438B.png" border="0" height="319" width="423" /&gt;&lt;/a&gt;  &lt;/p&gt;&lt;p&gt;Then you need to right click on the .chm file and select properties. &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mTwzy5IFKAKWJa-oJ8kKscTqOfjkQzKSsTzIAUpc6kD9NI8T0WNE1YLa8FoMTxdt2ha63HDQGrv3gz7iv8nFzSnCPLwe51r-Q-Sg5atll1kEC88xLRXe8ypPac32Wq-dniCGVfx2YPF9ZlJ0L1pJu0g/image%5B10%5D%2017A43D77.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m_Ilcf7imZPRtnqVkBSURlGLjDymQOLQtTcxrRFOt80GQYIVTbaCZdKiDsXziYS1QJrrZJGUe4RlzmWVId_QnRNFbk8XpMttnIF_IIYrdWc8SReqf6DujDZHNy5ioJeffajNczMNA9uZXppdiOizMjA/image_thumb%5B6%5D%2006139105.png" border="0" height="169" width="286" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;In the properties window, click unblock, then press apply and ok. &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mhAYHgI8JPEBrC8Pk4dUJWE3kkXLTiZIet7KErfeooejm1XdQzqbNpfd31Q2FecuGdQRYePOBXcMYQbdiqZmYqHLMgJ9Dyd0-mWe4L01VLQZZwDLCKPuQHe2hMa5awOa-0syTx9Tnp4MqiZjQ0cO7KA/image%5B17%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mTg_yyBt6NwWXAmlqYyN4Ii4FUYRmhtqmIRp4V5RNkBk5XQo7QQzLxEHkMcZFDJBxxishAIc5LczWr3F9AxO70ACnVKgAT2FlXpsoCEPSYFxpPX1UaY-U7XeJwUQGhX2VhhUjHoUQ0AhE0lEAgZXSMw/image_thumb%5B9%5D.png" border="0" height="364" width="268" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;You should then be able to view the documentation and it should look like this. &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1m7_FETMwVc6vEXb_iWy0SVVDYaAzyLxcA1cFf1FiEco5aT0j5e_hNLX8gCXqLTg7eAmy_Xf2VY9Uqy-a05KWg9j_XvVqI777bRibjyw-e_EJoZMkjf7Wt-WFYUUR1WzKmFjXEIW1Gpd3f4yTjUlLFNQ/image%5B22%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mcOXwmIxyI9c-lESvClZlWhCo7_GY-PY-3zmoS9eT6bckjb-CQEnI9eex_4bR8TIGx3RM-OUw9H27nRInJwbbUM8ZYQjNTxsyy1lMsKaCOlP9RDDsB0ayiCfINRxOJuDA6inKrisPdBba66NF6BeybQ/image_thumb%5B12%5D.png" border="0" height="385" width="512" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;The documentation contains lots of examples of how to use all of DocX’s features. If you find a mistake in the documentation or if you would like to add a code example that you have written please email me. If I think your example adds value to the documentation then I will gladly add it and mention you in the credits section. &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="color: rgb(0, 128, 192);"&gt;Changes in this release&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;ol&gt; &lt;li&gt;Added two nwq overloads DocX.Load(System.IO.Stream) and Doc.Create(System.IO.Stream). &lt;/li&gt;&lt;li&gt;DocX.AddParagraph has been renamed to InsertParagraph and now allows a users to insert a new Paragraph at a specified character index in the document, 4 overloads are available. &lt;/li&gt;&lt;li&gt;DocX.Value has been renamed to DocX.Text. &lt;/li&gt;&lt;li&gt;DocX.Save has been renamed to DocX.Close(bool saveChanges). &lt;/li&gt;&lt;li&gt;Paragraph.Insert, Paragraph.Remove and Paragraph.Replace have been renamed to Paragraph.InsertText, Paragraph.RemoveText, Paragraph.ReplaceText, new overloads are also available.  &lt;/li&gt;&lt;li&gt;Paragraph.Value has been renamed as Paragraph.Text.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;If you would like to send me feedback on DocX, or if you would like to make a suggestion for the next feature I implement, please email me at &lt;a href="mailto:coffey.cathal@gmail.com"&gt;coffey.cathal@gmail.com&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;happy coding,&lt;br /&gt;Cathal&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-7899971228989824052?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/s-nUXEvcDsI67xosqE-fMH8S9r0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/s-nUXEvcDsI67xosqE-fMH8S9r0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/s-nUXEvcDsI67xosqE-fMH8S9r0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/s-nUXEvcDsI67xosqE-fMH8S9r0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/yuy-qWcySM0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/yuy-qWcySM0/this-blog-post-is-to-announce-release.html</link><author>noreply@blogger.com (Cathal Coffey)</author><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/04/this-blog-post-is-to-announce-release.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-4203680909538900457</guid><pubDate>Thu, 09 Apr 2009 06:12:00 +0000</pubDate><atom:updated>2009-08-25T07:20:55.204-07:00</atom:updated><title>DocX version 1.0.0.2 released</title><description>&lt;p&gt;&lt;strong&gt;&lt;span style="color:#0080c0;"&gt;Note: Code samples have been updated to work with DocX version 1.0.0.6.&lt;/span&gt;&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;Lots of people emailed me asking me to add support for Images in DocX. So I did. Version 1.0.0.2 which can be downloaded from &lt;a href="http://docx.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=25829"&gt;here&lt;/a&gt; adds basic support for &lt;strong&gt;Images&lt;/strong&gt; and &lt;strong&gt;Pictures&lt;/strong&gt;.  &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Images&lt;/strong&gt; and &lt;strong&gt;Pictures&lt;/strong&gt;? Are they not the same thing you might ask? No they are not! You can think of a &lt;strong&gt;Picture&lt;/strong&gt; as a customized view of an &lt;strong&gt;Image&lt;/strong&gt;. Once you have added &lt;strong&gt;Images&lt;/strong&gt; to a docx file.  &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1m3zh7Y8lw2lfCvIW7LqCtl9CNjBzamuEvXnXKEb8a_eZxylQfv8qzR2LTEjKjmdFL-I2KsLXSzdCyHTHVW1h3sW0Na98dkzOdkWSl6350UccAxqAI47Zi3nvdMCDdXmo7DYeK_vipYyuGGMQnR_-FzQ/image%5B16%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mK3CXc0Wk5YgJN1_X1SgpDXmjGs0lExpjyqIlwWAgXa15uuutSCkY8KvoirCwvgeOlpgigF6NEH1OguSZ_pPMHi-VIJ1Ys13liaIXGLIxYZwCNTDPiyb2qC3-Q8tsfo2H858rDIx3bDYjSJ1SgvUPmQ/image_thumb%5B10%5D%201A0249F2.png" border="0" height="252" width="605" /&gt;&lt;/a&gt;  &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;You can then add multiple customized &lt;strong&gt;Pictures&lt;/strong&gt; of those &lt;strong&gt;Images&lt;/strong&gt; into &lt;strong&gt;Paragraphs&lt;/strong&gt;. You can do all sorts of interesting customizations with these &lt;strong&gt;Pictures&lt;/strong&gt; before inserting them into &lt;strong&gt;Paragraphs. &lt;/strong&gt;At the moment docx supports the following &lt;strong&gt;Picture&lt;/strong&gt; customizations;  &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Rotations and transformations&lt;/strong&gt;  &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1m-lw9I5csrelGveWdP_-mG_AKH2yU-tE_3lpg6YwAHQIviB90txLAT_IxHeHQTMftMNw8PC4cekNgtOICnMNy0yPaDwzldeTIIedwz2f3K5Mdr_AGLGFyatPqdpyAIXNIcGy3WKjwQzRly6xhv4BSGA/image%5B37%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mh-vgaXPnz47zomNY7c1KCT27LUNNbq5N-zyDJ-xUahbm3z0UY2NBQwJK_SjbxIQ6W1qCnwpK6UIynczyai0LjoUejTkmFGx9_qI0bsG3czeB-C6slBrEEk-yjBTyAE4BqBmQsxx8j58hLIbTuhls1w/image_thumb%5B21%5D.png" border="0" height="150" width="172" /&gt;&lt;/a&gt;   &lt;a href="https://u8hm0q.bay.livefilestore.com/y1mhf7wFeHLLN94LSuWs0j030ByryDZK4OpklFZodfwCJa7Cp_MqS7CD-0byrU6a671EvIMoTbdG4n1-J8EevWSLZqV5qXmrBC0HadGUK1EmA7aCW8fxuvbyRYkesT6mYNOas2OpHdcYL_pfUoKoBvHBg/image%5B33%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mxnWhGER0f-dBw0jbaiC5dr2e-_3FFa8oi1YoIrNxx0gO7-Aqx_UXM3NAnnAw6EyJEIxjs9YNh6enyz1czjmc0NG9MeZJwZIRBKpQNiVvh9ohY5w4S8ETfVvzuOQCYcUdyeJxREaYRNbCR3slYPUfTA/image_thumb%5B19%5D.png" border="0" height="110" width="145" /&gt;&lt;/a&gt;  &lt;a href="https://u8hm0q.bay.livefilestore.com/y1mQVXzrLcoaAl8xLfaXEopqKKfhMKXO2uXsnLIIK9WCzyuX-HIhPXQw9cIv1vSCoH2wwkok1VUWVJvatj-JRCvJcJ50qcJ90vH69fnhDVu7Q2ZhOrpNFThUfaNTWVA4YPVeWA786AiKyA2ADJzc1ywgg/image%5B44%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mw0DtcIwqGb7KR1LgFdX6SN08OrRk4g92KYoJIoZvQQVXVjCIbwW76x3hohwYDhSS9iO7TY7HQ2WBUAZ-RwyemWhy78wC29gLYHmGvHODYKm2tOtidwlxgxWjCRUgockTTZ5s4B8hkhXTzJaqK2aACw/image_thumb%5B24%5D.png" border="0" height="110" width="145" /&gt;&lt;/a&gt;  &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Resizing&lt;/strong&gt;  &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mlFwkycUcdPOFyXTYEUdLcrnQeBlsfvcIPhDhyj9rKl0yudqDv99wv7rI1EQ9haP9MQSB-f0S8eySB7fDlP1gdLYfytFJtj_f0RaGPPBSbApMFVq02_jMku9dD7o6-wgHtf1Ju51dRDMrQ41-3DbTlA/image9.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mWeeJzRaMpxgip7NYzHKE6rBREAJogBMg5LRcV00v9HHlSs1kxFS_rw5J3yb7OlB2VS14gsKbPs2LitkSCLaBZk8mZKJW5ePFOJ70wr3P_FszahNvV9KBG3W9Wv4PEPfUm4WqJiQoltAR_zs_Osq49Q/image_thumb3.png" border="0" height="181" width="240" /&gt;&lt;/a&gt;  &lt;a href="https://u8hm0q.bay.livefilestore.com/y1mAiOpsKscslZ83KpeuLWupjANHpiXIgeND7dAKFuqfJ4rCvRzboqcE4fgtVefrVk4JV0ytfl9GPR8N6NN6UQL4d6bw9jTHs3sgpAfc-WcFB-RviIkP2N2eGaT5cBpQ-znDXGxVgAz67dS_yyA6Mpz-w/image10%206B537746.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1ms3dBvpUvQwXXPExNWyEAJ_20gw9QWlSEed4Hw7F8C0v1niGGoZIBoawlbxKmT4VXzS31hmyUQP4v8TjZHtEMoEliJzuLjJsL9T22x3jqzKSmQwS_ZMDvtVQ28jIf4Lj4-ANjLFgdRYrCgIkfaJd0yg/image_thumb4.png" border="0" height="151" width="200" /&gt;&lt;/a&gt; &lt;a href="https://u8hm0q.bay.livefilestore.com/y1m-ap8NyhY3DeuOt8mA4mv_2FOdK_vKz7Ad0bfweYQfHL0N1TxtRRke0f0SYVXz_q9VwE0GVEDKi-7VstISYTqHj6c3pUfmeCRzj_tcqRyH0AV8jIMMX4P_zCqePuz93R_cY0oNrW36WAGBW3V5he_kQ/image11%5B1%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1moAhO5zXDw9mWzoDH5M5Gcy-d2P0oudVDubHnWtC9B8RBvUWXUIM-TBj_JSyXz2NrB5HKdgDDHiSesCwJLASjXoA93gvh5JPV9K6wCFxG2Yi8RPFm5jgIqZzGRsHDwPMP7agZW2u5oRThUI7yfcQE6Q/image_thumb5%201DA310FA.png" border="0" height="97" width="128" /&gt;&lt;/a&gt;  &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Shaping&lt;/strong&gt;  &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mCEwB-JVKTdDjkBfMJlBuhpfL8SPFk3nnRJf7TAAcfs8e7G7dM8p0AWKnTmF_98aROmiIfCNhk-zCGdyGSpecElxoDXi1Jx7Li-vTyE8FJyz6eEfeONg4ypHGghpKtBxxjWl03aBpR7k710zPcQhMaA/image%5B63%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m_RawkEogEa3x-SUdrlIutABAMC9jMvMgIYiY313myI8bk2heoSb5qGBKibmdVQoDkzxeakK9wmko9zy6GF2ghAAdmhbZr11rxgI3u50LDD8JUtZOPnup5l7AquolRuIjX4iOBriEhXYfvSaT9LnJdw/image_thumb%5B35%5D.png" border="0" height="132" width="174" /&gt;&lt;/a&gt; &lt;a href="https://u8hm0q.bay.livefilestore.com/y1mvGDh8-GU-b-xw08sowmxpLwuW18tQ3hPJmEmjwcf3MDu3FRFOgr12ZVbbJU6hL6nbC_kttExrGnu-S2jJXUzPDHMqjtTwh-vaV76tB8vpucd3p2fM-vQniAvea8JB3ZN0SPQuL77nQPlMwoia4xJ-Q/image%5B64%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mX_wS89DBeXsf858ilt2umwfjhmbfURvDrgNeys-qMJXGqOBK2xNDCpwimbrDusWkH0wphHKnVzlMtU5trlOubVUYfqn0dj7_1T-T2fILeapRMkpSUQAD5QpfA0yNK7AWKFbvmeR1trBHAOYb5a1aYQ/image_thumb%5B36%5D.png" border="0" height="134" width="177" /&gt;&lt;/a&gt; &lt;a href="https://u8hm0q.bay.livefilestore.com/y1mKLjc9xhnxFx8tQZ4A1AZ8-ASPlRe_5ec90MVCFST4QtnMZQoGVjwJzHs7NaSuD-eqjOdlsgkymAsewLBaixaMX5s2W4gGboWmajiceQNgVuaFOQoiytNYJSSSCG8zTqMdMCFZY05RDu-DKGRBH1f5g/image%5B65%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1meQHo8cJbTZGtPFBl_dwJYrQ3zEoWQOwMQlH2HXlGj45UrFie5TZpewH6gqCpBTBMq9a-_MXwNeYxRP7DWc-HXz5a-oQ9Qs-M20L8JnXtLfxKiwLRMI2AEMnnMtXdcsJI-dw2BL-KZ0s1DPKxNPp1IQ/image_thumb%5B37%5D.png" border="0" height="130" width="153" /&gt;&lt;/a&gt;  &lt;/p&gt;&lt;p&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mXZwBURgLzRSg2LLq-Pp4wDuYRKNW-L1OXAcBewFvLJNFKovhVqiGOheZM1-cWvNA25NF1rdeLxdeGlSYwsrqNKC-mXnMUi0EwiWWB4gE_vvzEbhzsr9ij5tlb5wzZW_6WWUmDEPCb8tnlcFzCAJDSQ/image%5B83%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m1m11_8vLUxas_ttMDoVEW2VxVXzL4VcU7HraJgHpQuJaAuDmcl2Lrx6HCyCq6JgzVJb0FwQ0YJQSOQ83Ays-8WDJAPsneWfvGR-bOasJLnYXw-9zDiv5gDrbjHiH-9nEJJLiP5DlOXP1yQq4HriMIA/image_thumb%5B49%5D.png" border="0" height="129" width="170" /&gt;&lt;/a&gt; &lt;a href="https://u8hm0q.bay.livefilestore.com/y1mwo-XryUPubP0yOGat26zSlUuw2ygieMyzVQqgPGImWDC_vWt2126wzjZiMnD1HISUDhXZ3Um7_8AzRCUncBvdEHHpZkuSSz5jDS--OkZ-QAM8sqq_Dom13KMU2my2jYUKRd3HkflkR34W0hiVgd0iA/image%5B82%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mKERw3w31RCIpuRVYYCCg_DhGmtveNlzoDfaM5TREE3TcOV_4UGUu_xQrZMBPPK8EpaCdUR955xGwrbf-WMAsjPk0falpdlS52Q37mGWT7M3dVwabV4MILQoqlGJahgJTi1KweGR2-EmAd9s44K0kKA/image_thumb%5B48%5D.png" border="0" height="126" width="170" /&gt;&lt;/a&gt; &lt;a href="https://u8hm0q.bay.livefilestore.com/y1mB1EcPn4fICAD2R_aDQl5Nf_X7ve7pXkovHI9wyATtFWNqsBEajrmeCRyo_fwcyyvf1IANUcSv71r9mi8vagZ0uAQPsUobh7oe9ewCXdx5cWvhGxPodlIIr9VGzktlPdBK9e6ya2g3mfdwM-1vrm7Ew/image%5B81%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mOutHqnt2OGZDV_HN5KDkcM_VpiWfw7zi23RlWbSU6rY_opm0sBws24MvPfxUva8UXMdZArvxgTIpAmUqSNxceK8ebH44E4Y2MlGOR6AS6joTtM3kopbv-X-6WLt371JIx681MWxoXKoDsn5h1CbvYg/image_thumb%5B47%5D.png" border="0" height="128" width="169" /&gt;&lt;/a&gt;  &lt;/p&gt;&lt;p&gt;Time for an example using DocX; below is a file entitled Example.docx.  &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mnJr5lsAGsodky1hR8yI2cNrV5ymk4Lj05WbXRdayxUy1Jrf9paNa5JsW-JJQixtoB0X2urC2jGnLAeZEwi68D8sDDBEkQx2MvS5HvuRTaMpvwbrLIdrqu_0KM8MrlLoQi5ZJ11I1LZz2YSv3cEYY1w/image%5B88%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m3iCaYJuwoQdH1YwZXiE8MxPXexJ9SUKucd8_Cw2b4oLJrt6o4kib1SedRNL9CG9X7giJ6a-Jy4B2Hvyztc7j50tsgsqOAwSiJCqC_MN4rFkyBEAShkEkcRUaWrF8YnvrrJa0bCbkDERVh0qljYwFuA/image_thumb%5B52%5D.png" border="0" height="281" width="482" /&gt;&lt;/a&gt; &lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.0 – Example.docx before code execution&lt;/strong&gt;&lt;/span&gt;  &lt;/p&gt;&lt;blockquote&gt; &lt;p align="left"&gt;The following code adds the Image Donkey.jpg into this file, it then creates two Pictures using this Image and inserts them into the last Paragraph. &lt;/p&gt;&lt;pre&gt;&lt;span style="color:green;"&gt;// Create a .docx file&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DocX &lt;/span&gt;document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Example.docx"&lt;/span&gt;))&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:green;"&gt;// Add an Image to the docx file&lt;br /&gt;   &lt;/span&gt;Novacode.&lt;span style="color: rgb(43, 145, 175);"&gt;Image &lt;/span&gt;img = document.AddImage(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Donkey.jpg"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Insert an emptyParagraph into this document.&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Paragraph &lt;/span&gt;p = document.InsertParagraph(&lt;span style="color: rgb(163, 21, 21);"&gt;""&lt;/span&gt;, &lt;span style="color:blue;"&gt;false&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:blue;"&gt;#region &lt;/span&gt;pic1&lt;br /&gt;   &lt;span style="color: rgb(43, 145, 175);"&gt;Picture &lt;/span&gt;pic1 = p.InsertPicture(img.Id, &lt;span style="color: rgb(163, 21, 21);"&gt;"Donkey"&lt;/span&gt;, &lt;span style="color: rgb(163, 21, 21);"&gt;"Taken on Omey island"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Set the Picture pic1’s shape&lt;br /&gt;   &lt;/span&gt;pic1.SetPictureShape(&lt;span style="color: rgb(43, 145, 175);"&gt;BasicShapes&lt;/span&gt;.cube);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Rotate the Picture pic1 clockwise by 30 degrees&lt;br /&gt;   &lt;/span&gt;pic1.Rotation = 30;&lt;br /&gt;   &lt;span style="color:blue;"&gt;#endregion&lt;br /&gt;&lt;br /&gt;   #region &lt;/span&gt;pic2&lt;br /&gt;   &lt;span style="color:green;"&gt;// Create a Picture. A Picture is a customized view of an Image&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Picture &lt;/span&gt;pic2 = p.InsertPicture(img.Id, &lt;span style="color: rgb(163, 21, 21);"&gt;"Donkey"&lt;/span&gt;, &lt;span style="color: rgb(163, 21, 21);"&gt;"Taken on Omey island"&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Set the Picture pic2’s shape&lt;br /&gt;   &lt;/span&gt;pic2.SetPictureShape(&lt;span style="color: rgb(43, 145, 175);"&gt;CalloutShapes&lt;/span&gt;.cloudCallout);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Flip the Picture pic2 horizontally&lt;br /&gt;   &lt;/span&gt;pic2.FlipHorizontal = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;&lt;br /&gt;   &lt;span style="color:blue;"&gt;#endregion&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span style="color:green;"&gt;// Save the docx file&lt;br /&gt;   &lt;/span&gt;document.Save();&lt;br /&gt;}&lt;span style="color:green;"&gt;// Release this document from memory.&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div style="text-align: center;"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1m_sDmC7yETpbsm0cAbC9EZwgycQGSsn2NXwXWst_Upgme7A4w9yNu02GNfjuKSmIYBFOihZ0I_HUkfFg66WUhjQVEOJ_j3S1RMEjtd3IXlLlwL5zNdbtFUPXnr_Ii5SMnHDM4fqCi3Ckamhr1MAxWQw/image%5B92%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mOMal5Hs6hWSRcQdWyWDoqx3xOm-jwxY_6ZanCXgwrF0ZCvLtjEyhwno9WifZ4js9izelwNH70FIKRSi9Z4C3CD2InJS50Kuwz5-9X1ES6RgN1QWAFyDEyrK2Q0JZW3Qm4zkbeuDlnuBjgevUxlNs1Q/image_thumb%5B54%5D.png" border="0" height="313" width="499" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;p align="center"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.1 – Example.docx after code execution&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Another interesting thing that you could do would be to apply an operation to every Picture in a document. The below snippet would rotate every Picture in a document clockwise by 30 degrees.&lt;/p&gt;&lt;pre&gt;&lt;span style="color:green;"&gt;// Load the document that you want to manipulate&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DocX &lt;/span&gt;document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Load(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Test.docx"&lt;/span&gt;))&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:green;"&gt;// Loop through each Paragraph&lt;br /&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;foreach &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;Paragraph &lt;/span&gt;p &lt;span style="color:blue;"&gt;in &lt;/span&gt;document.Paragraphs)&lt;br /&gt;   {&lt;br /&gt;       &lt;span style="color:green;"&gt;// Loop through each Picture in this Paragraph&lt;br /&gt;       &lt;/span&gt;&lt;span style="color:blue;"&gt;foreach &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;Picture &lt;/span&gt;pi &lt;span style="color:blue;"&gt;in &lt;/span&gt;p.Pictures)&lt;br /&gt;       {&lt;br /&gt;           &lt;span style="color:green;"&gt;// Rotate this picture clockwise by 30 degrees&lt;br /&gt;           &lt;/span&gt;pi.Rotation = 30;&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Save the document&lt;br /&gt;   &lt;/span&gt;document.Save();&lt;br /&gt;}&lt;span style="color:green;"&gt;// Release this document from memory&lt;/span&gt;&lt;/pre&gt;If you would like to send me feedback on DocX, or if you would like to make a suggestion for the next feature I implement, please email me at &lt;a href="mailto:coffey.cathal@gmail.com"&gt;coffey.cathal@gmail.com&lt;/a&gt;.&lt;br /&gt;&lt;p&gt;happy coding,&lt;br /&gt;Cathal &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-4203680909538900457?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_extAsbr8fPTYFwdAdxVTiu48EI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_extAsbr8fPTYFwdAdxVTiu48EI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_extAsbr8fPTYFwdAdxVTiu48EI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_extAsbr8fPTYFwdAdxVTiu48EI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/a62_WXderWA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/a62_WXderWA/docx-version-1002-released.html</link><author>noreply@blogger.com (Cathal Coffey)</author><thr:total>2</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/04/docx-version-1002-released.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-7664559987032277477</guid><pubDate>Fri, 20 Mar 2009 06:23:00 +0000</pubDate><atom:updated>2009-08-25T07:23:33.250-07:00</atom:updated><title>DocX version 1.0.0.1 released</title><description>&lt;p&gt;&lt;strong&gt;&lt;span style="color:#0080c0;"&gt;Note: Code samples have been updated to work with DocX version 1.0.0.6.&lt;/span&gt;&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;I promised that I would release DocX frequently, and with lots of new useful features.  &lt;/p&gt;&lt;p&gt;Version 1.0.0.1 which can be downloaded from &lt;a href="http://docx.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24973" target="_blank"&gt;here&lt;/a&gt;, allows a developer to create a document on the fly, add new paragraphs and insert highly formatted text. Just about every font option that is available in Word 2007, is now exposed by DocX. These options include, but are not limited to; font, size, bold, italics, underline, strike through, superscript, subscript, color, highlight color, scale, shadow, outline, emboss, engrave, hidden, spacing, position, kerning.  &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mfaOJVuFeoYv5YDPxraz_ocrVOL4WPeDXH7iHBo5kODSeulKPKCYfvix9zJQhjHlBcKSshYKKqwwBStjKMB9TUqNvmQF4vdKmRTJw67DlaPLdkfyjo6YR65p4_gwDgnL1AGB4TSsbPbo/image%5B3%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mrIpGKNsw_inOg6s2haVbXqusn6mKDlG5FFVRA26BW7qbYapzbMWr7i9hA_Ry5N3h61q4ppfN06T32G7Mo8_19OWndvhG-vRJ6XPvnrbO9VQwlqMbXYyl-8CI-W49mz485kME7jw5v78/image_thumb%5B1%5D.png" border="0" height="372" width="351" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.0 – Word 2007 font options, tab 1&lt;/strong&gt;&lt;/span&gt;  &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mPySSFrNij2CRp8PNCwGcDhTL60Ai9mbT1PaK7-IwH-wgPa_pmitPJiuUslK_MTvXqbG10Aa2OL6Y6a6CgGmGQGawZRTZ-e7LqC9WPzuDRpNds-kz8WOKsr6X0jyJw2nqt5rqVU6L7y0/image%5B7%5D%20066B5BE2.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mft7849UO2_KSKDseJIT2xDFimzAYSpfmm_Y9KHO6nThEHEL_XnHW_MJg6tsiI5yOMowh-ZL7tGa-zaxACI-P9sTArE8ha5IxUEGCaOGJ6o2w9X3oBzd8FIGxsTriU7jUnMuZ3uKmJlc/image_thumb%5B3%5D%206D4F4002.png" border="0" height="372" width="351" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.1 – Word 2007 font options, tab 2&lt;/strong&gt;&lt;/span&gt;  &lt;/p&gt;&lt;p align="left"&gt;Here’s an example of how to generate a docx file, which contains custom formatted text, out of thin air, using docx.&lt;/p&gt;&lt;pre&gt;&lt;span style="color:green;"&gt;// Create a new document.&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DocX &lt;/span&gt;document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Create(&lt;span style="color: rgb(163, 21, 21);"&gt;@"Test.docx"&lt;/span&gt;))&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:green;"&gt;// Create a formatting called f1&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Formatting &lt;/span&gt;f1 = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Formatting&lt;/span&gt;();&lt;br /&gt;   f1.FontFamily = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;FontFamily&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"Agency FB"&lt;/span&gt;);&lt;br /&gt;   f1.Size = 28;&lt;br /&gt;   f1.Bold = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;&lt;br /&gt;   f1.FontColor = &lt;span style="color: rgb(43, 145, 175);"&gt;Color&lt;/span&gt;.RoyalBlue;&lt;br /&gt;   f1.UnderlineStyle = &lt;span style="color: rgb(43, 145, 175);"&gt;UnderlineStyle&lt;/span&gt;.doubleLine;&lt;br /&gt;   f1.UnderlineColor = &lt;span style="color: rgb(43, 145, 175);"&gt;Color&lt;/span&gt;.Red;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Insert a new Paragraph into this document.&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Paragraph &lt;/span&gt;p = document.InsertParagraph(&lt;span style="color: rgb(163, 21, 21);"&gt;"I've got style!"&lt;/span&gt;, &lt;span style="color:blue;"&gt;false&lt;/span&gt;, f1);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Create a formatting called f2&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Formatting &lt;/span&gt;f2 = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Formatting&lt;/span&gt;();&lt;br /&gt;   f2.FontFamily = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;FontFamily&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"Colonna MT"&lt;/span&gt;);&lt;br /&gt;   f2.Size = 36.5;&lt;br /&gt;   f2.Italic = &lt;span style="color:blue;"&gt;true&lt;/span&gt;;&lt;br /&gt;   f2.FontColor = &lt;span style="color: rgb(43, 145, 175);"&gt;Color&lt;/span&gt;.SeaGreen;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Insert new text at the end of this Paragraph.&lt;br /&gt;   &lt;/span&gt;p.InsertText(&lt;span style="color: rgb(163, 21, 21);"&gt;"I have a different style."&lt;/span&gt;, &lt;span style="color:blue;"&gt;false&lt;/span&gt;, f2);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Save all changes made to this document.&lt;br /&gt;   &lt;/span&gt;document.Save();&lt;br /&gt;}&lt;span style="color:green;"&gt;// Release this document from memory&lt;/span&gt;&lt;/pre&gt;The above code will generate the following document.&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mzwpzcELiuDPEivklrrFAVTae_IcPVPKwIT9YngyilyliKIuJu18t8rtx8h0ALEPVWb3dgYXL4C83LU5K2DzzMvxYm1NCrNHmYzpdnYG8pPeVKg10Joje1c4VngoWKvMXkwWghatMIaA/image%5B12%5D%205FC8E162.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mbC1zxSad-aAr96NWK_W5VWOAHF15UKHwpc49r8dGu8PjXiYyPeaIAfjmiGrAPYxp34xWLnWnc6O8_w353U7xt--hTOS9ur-lxcZP2HC2KISamNPskRYyxXM2_SPkgF9MWW6zXuSGIiE/image_thumb%5B6%5D%2042533DFE.png" border="0" height="355" width="497" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.2 – Out of thin air&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;The coolest thing about this code, is that, you can generate .docx files in the cloud, without a dependency on Microsoft Word.&lt;br /&gt;&lt;br /&gt;Please remember that DocX is not a full blown solution for .docx creation and manipulation, not yet anyway. It is a project, that I am working on, in my spare time. If you would like to request a feature for version 1.0.0.2, please email me or alternatively leave a comment here.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;My current aim for version 1.0.0.3, is to add the ability to create and manipulate images, tables and lists.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;happy coding,&lt;br /&gt;Cathal&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-7664559987032277477?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kImQYYGqcmekmax3vnQp6Ge9Ajc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kImQYYGqcmekmax3vnQp6Ge9Ajc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kImQYYGqcmekmax3vnQp6Ge9Ajc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kImQYYGqcmekmax3vnQp6Ge9Ajc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/PHloNFcfos0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/PHloNFcfos0/docx-version-1001-released.html</link><author>noreply@blogger.com (Cathal Coffey)</author><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/03/docx-version-1001-released.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-6326209380076030280</guid><pubDate>Fri, 13 Mar 2009 03:35:00 +0000</pubDate><atom:updated>2009-08-25T07:29:28.854-07:00</atom:updated><title>Compiling DocX from source code</title><description>&lt;p&gt;I received a few emails outlining problems that people have encountered while trying to compile DocX from source. This post explains how to solve those problems. &lt;/p&gt;&lt;h4&gt;&lt;span style="color: rgb(0, 128, 192);font-size:100%;" &gt;&lt;u&gt;Unable to read the project file “DocX.csproj”&lt;/u&gt;&lt;/span&gt;&lt;/h4&gt; &lt;p&gt;Anyone who downloaded change set 17108, this was the build uploaded (Mon&lt;abbr&gt;&lt;/abbr&gt; at 6:58 PM) would have experienced the following error on opening DocX.csproj in Visual Studio. &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1myvMcKdHhzANa2wqCdCr3oQBKwwMgy9EK3u3DV5U40BDlXUKHWYeQr6JGZF3VFPfPNxlZ6V601PKKDBmxUvh3gYpCZxBQ0QrbIOCNvJqwkguqqV0LJypT6Ww8SQaL2xRxWF1Y180jFiE/Unable%20to%20read%20the%20project%5B3%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="Unable to read the project" alt="Unable to read the project" src="https://u8hm0q.bay.livefilestore.com/y1mZh4Ie0heMWoWveVdSByAikuxvaxPbLjctRSFhyOkb6gf9UJfjL-7NoSKVMcdM8ItVCS1v3zmOJtq6A6pwz1TXnlWTa0pOWZvN995eNrUIXaZx__1ydDRX9Bfvu4yE2djew8vhSKzu6M/Unable%20to%20read%20the%20project_thumb%5B1%5D.png" border="0" height="170" width="317" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.0 – Unable to read the project file “DocX.csproj” &lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;p align="left"&gt;There are two ways to overcome this problem, &lt;/p&gt;&lt;ol&gt; &lt;li&gt; &lt;div align="left"&gt;You can simply download change set 15663, this is the build uploaded (Thursday at 11:08 AM).&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div align="left"&gt;Open DocX.csproj in a text editor (notepad.exe) and remove the following two lines,&lt;/div&gt; &lt;ol&gt; &lt;li&gt;&amp;lt;DeepSeaObfuscate&amp;gt;false&amp;lt;/DeepSeaObfuscate&amp;gt;  &lt;/li&gt;&lt;li&gt;&amp;lt;Import Project="$(MSBuildExtensionsPath)\DeepSea Obfuscator\DeepSea.Obfuscator.targets" /&amp;gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;u&gt;&lt;span style="color: rgb(0, 128, 192);font-size:100%;" &gt;Missing reference DocumentFormat.OpenXml&lt;/span&gt;&lt;/u&gt; &lt;/p&gt;&lt;p&gt;If Visual Studio’s reference window cannot find DocumentFormat.OpenXml then you need to download and install the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&amp;amp;displaylang=en" target="_blank"&gt;Open XML Format SDK 2.0&lt;/a&gt;. &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1msgwAn6LozmsRsYZsSdb5y6eaWnHD6aLhs8z8fyQnyPagYyPld6MNO0lKHpP2MHeejz3meYQZzqEQbruHkG4mcniHcVaADX8h34kSVzF_Pt18VRYNFM-Fm0mghz6giRNIU1BtoY2Zvxc/image%5B7%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mPoJnMUphO5aevr1_6QrXU7sWV9i0MtC3TrIOe3iKovsy6a0WRlhonGXdYGvcq3-VEItqG5rE5jlH5HTHvsdPNaakggJO11gjv46KWUwdccmhljUHEFd_9lrYKa4Q2yHfjRT3BueIP8I/image_thumb%5B3%5D.png" border="0" height="275" width="230" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.1 – Missing reference DocumentFormat.OpenXml&lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;p align="left"&gt;&lt;u&gt;&lt;span style="color: rgb(0, 128, 192);font-size:100%;" &gt;Test projects missing reference DocX&lt;/span&gt;&lt;/u&gt; &lt;/p&gt;&lt;p align="left"&gt;If Visual Studio’s reference window for the projects &lt;strong&gt;CustomPropertyTextApp&lt;/strong&gt; and &lt;strong&gt;StringReplaceTestApp&lt;/strong&gt; cannot find DocX then you need to update the reference. &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mffJhqe8lVRGH3A2BNW9lZAtZCZIfIDJIpQQI57s4ExTvAC0ITHwcDwgKPrc9r3XWw54ZFxgK7gn6yESMPVtmcglf5uFX6ONSjTB2w2TpIibCVW6q1k-RsB39zsOQRF3kpH7t_UkujYk/image%5B12%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mqOfo7_q4BepUXhD4r4We34i81JGLtMv-uaPQCQPdTU6yoJrHBqPLEtScaFeWy_0BlwHOPYk3u8bbKIyHVl0H3kAmull6tBRdQJMoa5EB6Mf4-tKMny05JiUYIQ4D8Iq16TF68zHL-rQ/image_thumb%5B6%5D.png" border="0" height="370" width="222" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.2 – Test projects missing reference DocX&lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;p align="left"&gt;First you need to build the DocX, you can do this by right clicking on the project and selecting build. &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1m38Vs8laW_Szar4O75K0Z-SNCe7SHzEorKKxJMpqc9Ptvrc9I8zOYSOg_XfgytdIfksBN-xyPNzMKsqsQZS5h0pUMXPyiOJEoLun29MUhp3uhO3CaYtF8aEprSYrNK-sUQr6tkEueMhU/image%5B20%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m2eRGBkjZT_-knlQoF-2Kpoy4PxAnZlvMCzL61w6PfwP-YyZNSOtt6k9W7Pm8tRlTHxKEJ2MzeMAp-U0wMDlI7uUI2wnTjfnfNrbNsS_hTH5gDHywHJAOAAQDQr4H75ktxvFliFF0I-s/image_thumb%5B10%5D.png" border="0" height="310" width="226" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.3 – Build DocX&lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;p align="left"&gt;Right click on the references for both projects and select “Add Reference…” &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mmH-scvJua2WvKtJ3-GEx_w02c72aYa0JZ-YQHDcdi29zUdRw_DxFrVp0Xkp04gNDhXX4khcqFgltv5iD0BHik8-uDRZBpYc3WjbrznZoLg03HmWePpxbqu1Vz8zUIuxjHwfiDihrPUw/image%5B28%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mhRIJzF9QSTKYtieUFTnelLEFSBy7l3-WNdsj21a5zOXjJV4MEZ3bHVjGXkxhJGc2BqXaKzHJFOwmEeTUoqbFXbSJGHBRXFfYiB-CsxApwB3nMBE_3gsR3ucswYvfHYa_CvupIxT7z0U/image_thumb%5B14%5D.png" border="0" height="255" width="342" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.4 – Add reference…&lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;p align="left"&gt; Select the Projects tab and choose DocX. &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1m1IXOz8Ziy5rVYidbzb55hHZEi2XCOI08M_TqqOpTxzAPvADpFrN4IEvcBkr327VmjszbiV9buL1-QOxwkBbTxVnF6p9iBTkmDs4tHTEMfkp7l13QzZ1wj43NXuURbQXvMHnNRjx7iP4/image%5B27%5D.png" rel="WLPP"&gt;&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m_Hu9ccDb0Y59U565DGqwUXVu8RqlkjJJ9orD0813zckX3ynHO5gYHOvPj33OO86WOjvoan9Yv1wlGQwdJYb5uSsZjmNpcJIB1Sv1CjtpWUJZuUC0a8kns03a1f21h615DJ0J7SkMStg/image_thumb%5B13%5D.png" border="0" height="257" width="353" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.5 – Select the projects tab&lt;/strong&gt;&lt;/span&gt; &lt;/p&gt;&lt;p align="left"&gt;That’s it your done, now the entire solution will compile.  &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-6326209380076030280?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AWrrCrm__fp6SgCI9jQmVdywy-s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AWrrCrm__fp6SgCI9jQmVdywy-s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AWrrCrm__fp6SgCI9jQmVdywy-s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AWrrCrm__fp6SgCI9jQmVdywy-s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/uuW8AtfxnKQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/uuW8AtfxnKQ/compiling-docx-from-source-code.html</link><author>noreply@blogger.com (Cathal Coffey)</author><thr:total>0</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/08/compiling-docx-from-source-code.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1138151560829907108.post-8445547926217989901</guid><pubDate>Fri, 27 Feb 2009 00:50:00 +0000</pubDate><atom:updated>2009-08-25T07:28:26.436-07:00</atom:updated><title>DocX - A .NET library for manipulating Word 2007 files</title><description>&lt;p&gt;&lt;strong&gt;&lt;span style="color:#0080c0;"&gt;Note: Code samples have been updated to work with DocX version 1.0.0.6.&lt;/span&gt;&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;Hello my name is Cathal Coffey. I am a intern working at Microsoft Ireland Research. This blog post is about a personal project which I have created outside of my work time.  &lt;/p&gt;&lt;p&gt;My project which can be &lt;a href="http://docx.codeplex.com/" target="_blank"&gt;downloaded from here&lt;/a&gt; is called DocX. DocX is a .NET library which allows developers to manipulate Word 2007 files, in an easy and intuitive manor. It does not use COM libraries nor does it require Office to be installed in order to function. The rest of this post explains the current features offered by DocX. Please keep in my that this a young library, at the moment it offers two very useful and powerful features  &lt;/p&gt;&lt;p&gt;1) String replacement,&lt;br /&gt;2) Set custom properties.  &lt;/p&gt;&lt;p&gt;-----------------------------------------------------------------------------------------------------------------------  &lt;/p&gt;&lt;h3&gt;&lt;span style="color:#0080c0;"&gt;1) String replacement&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;The document below Test.docx contains the string “pear” lots of time. There are instances of the string “pear” inside structures such as a table, a list and a hyperlink. The document also contains lots of different style properties such as font, colour, bold, italic, strikethrough and underline.  &lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mr4IecTCDk0k88xOBSY5pj4mhU8yO1YcUQX__uC0XSKdlbnp2sMfGTNd0OzPmd4c7hepoSBHjsPKhJEq_e-5KM1KAro84_i_MMSd1_i8Z-hh3CiVQKcEvERKh8HJCMETklxD73tCrpzc/image4.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="Figure 1 - Test.docx before manipulation" alt="Figure 1 - Test.docx before manipulation" src="https://u8hm0q.bay.livefilestore.com/y1mO8v2FSOdddqCuD8xiv8kzZoD7M94ecnOm48lFu1uAnY8aO6JSFcujPLalyN0thov1Rn6JCVYPqj_uXojVBcDuXc6Tjr9ebx64GCbwWyzxyJblP_Tt2atH9AOuaS975jThIHotVkFIek/image_thumb2.png" border="0" height="362" width="506" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.1 - Test.docx before manipulation&lt;/strong&gt;&lt;/span&gt;  &lt;/p&gt;&lt;p&gt;Replacing the string “pear” with the string “banana” is a trivial task using the library DocX. &lt;/p&gt;&lt;pre&gt;&lt;span style="color:green;"&gt;// Load a .docx file&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DocX &lt;/span&gt;document = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Load(&lt;span style="color: rgb(163, 21, 21);"&gt;"Test.docx"&lt;/span&gt;))&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:green;"&gt;/*&lt;br /&gt;    * Replace each instance of the string pear with the string banana.&lt;br /&gt;    * Specifying true as the third argument informs DocX to track the&lt;br /&gt;    * changes made by this replace. The fourth argument tells DocX to&lt;br /&gt;    * ignore case when matching the string pear.&lt;br /&gt;    */&lt;br /&gt;   &lt;/span&gt;document.ReplaceText(&lt;span style="color: rgb(163, 21, 21);"&gt;"pear"&lt;/span&gt;, &lt;span style="color: rgb(163, 21, 21);"&gt;"banana"&lt;/span&gt;, &lt;span style="color:blue;"&gt;true&lt;/span&gt;, &lt;span style="color: rgb(43, 145, 175);"&gt;RegexOptions&lt;/span&gt;.IgnoreCase);&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Save changes made to this document&lt;br /&gt;   &lt;/span&gt;document.Save();&lt;br /&gt;}&lt;span style="color:green;"&gt;// Release this document from memory.&lt;/span&gt;&lt;/pre&gt;After running the above code and reopening Test.docx we can see that every instance of the string “pear” has been replaced by the string “banana” and that both deletions and insertions have been tracked. By hovering over a deletion or insertion, we can see that the DocX library has used the credentials that it was executed with, as the author of the edits.&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mPpwejzgop6NNv6_3Bf8TQSYayVP1NijjbKx6NbaKvlwxuCq8hfNmv7AAViZxxWzlZ4pL62ULM_tBif3ryhONpL0bcEl1Wqz7hJI_Ka5_vOKFe8wCJRbmop7Ek9z1ZkG1iAUhP-o-3ow/image4%5B1%5D.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m3rpjGiqCOFIgm0emo2mD3Yp0wr7eXmnhYEZJIJ-n9E7R_qa6cuK6UAiRRRh8bCv8rx-Rwq2VRHdoLVbPv731PHEh-THt8o9hdd1z1TeE0YfCRvzIsEqsZwEhHa_9oM6M-HIiZJF_2No/image_thumb1.png" border="0" height="362" width="506" /&gt;&lt;/a&gt; &lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.2 - Test.docx after manipulation&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;If we click on the “Review” section of the ribbon and select “Accept All Changes in Document” it is now clear that DocX has correctly replace all instances of the string “pear” with the string “banana”.&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1muPax0rjHa86a8XyznNKJTDrGxIx9tjMklCt-V-KlFqrgmhtxVEcCzStuh4WRA5jPt7hxdkaYt6G5ZBMbIoWYQIlR91NObTXoPvb2PuU5aQGW8HIzoJ0BSca-PDvsd2AEGMRB8UhXE-w/image10.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mmMh2DDWXDBf2jhKiUBy7eorcHpSf-9eFCNqwlrfKuT2Tg478jsgzcGEAj5l7-FIQ5qXmwMFgyEGao6kASEO9sSVuBym1nYlOX01n6NjdJVXjqJOL1MUdnbBuJwxsn5OQV5cMJMsiVps/image_thumb5.png" border="0" height="123" width="506" /&gt;&lt;/a&gt; &lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.3 – Test.docx Accept All Changes in Document&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;An important point to note is that the DocX library inserted the string “banana” with the correctly style information in each case regardless of what structure it was inside a table, a list or a hyperlink.&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mAYD22CnEVamOcdc9J_L1Rbw_KINafC3oatQDBtE4HRlGoGvo4ABaJEPXJzL4AnvYAHWT3WCDNfBepC-_O4RaP9HWpZm4FiXWhltcunWlcg7G3vMNbNtI-hMoshjVO-ucDvllLe8vhGs/image14.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mbHDMabhsOxJJzyxVvxwyBRtly9p7ev4WWOhjhdwzKdk2-b2PVLM-keq3Hx9jtaHX2r9CMdZsU8XWs1e0hqaqME5ELhoVd4qRM__gPoLtspTv6sXS_cZvdrjdsn4YmvoNGP16djaXyE4/image_thumb7.png" border="0" height="360" width="506" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 1.4 – Test.docx After Accept All Changes in Document&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3&gt;-------------------------------------------------------------------------------------&lt;/h3&gt;&lt;span style="color:#0080c0;"&gt;2) Set custom properties&lt;/span&gt;&lt;br /&gt;&lt;p&gt;Custom properties are place holders for real data; they can be of type Text (String), Yes or No (Boolean), Number (Integer or Double) or Date (Universal Date).&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;To add custom properties to a document you select “Prepare -&amp;gt; Properties” from the Office button menu.&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mwRhxxcRukzZmMjQnflqM7i92TvFa3uNtF_ROF5VKtNe-ejzcA_w33Ecwka1TYrN1DgTvrTyxl_C0WACDjwibcBf2ZgLDOWDT203yd5wWDYreooKY_7tCj-wN4LLyaKI1WJ73C0QOpPo/image29.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1myVmZdqzRT8ATCZ-_AIl63RGo1cnZY_HEQGzMTfyz4z_9x4dUplPjOJ_-KcIHrN3Ko26AbixwFTOpLfe8YnA7C3e9NspCbpf9oNHdBoavD24uzi35PfdEKoTH-_U1pnQtcHqq-ZzcUk8/image_thumb14.png" border="0" height="335" width="304" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.1 – Office button –&gt; Prepare –&gt; Properties&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;You then select “Document Properties -&amp;gt; Advanced Properties…”&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mLSGNZr1nzdoSr5Q1j58TOemEf-wbZsDL_rCwAEkxsNntSHVz2TyIDdbVfogQJUAKiEx9y_HYD5RlI_My-hQLSHqUkxK6wCWXes6M3N0Wu7Ny4CRft1DjPeh4Cm3_nzBbduGSZM7WuOY/image28.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mYyrrYFm7-ptIVUQvJCd7tGZ4z7AO4vTz6a8GrSFZCnzHBUicOxDl7zrqbcyKZaWgA4VycbpfFRm-IYsWV1SIkIUl3MkAxn1ddEpWU4_4L5L3qTEQMxlLhwAiqO_gGtAnRTOreJ1mLH4/image_thumb13.png" border="0" height="165" width="506" /&gt;&lt;/a&gt; &lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.2 – Document Properties –&gt; Advanced Properties…&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The following window will then popup and you can create your own custom properties.&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mo5i_kqC8Wewm4qMipeEMHmWsWAhvwYx9jPBGIshO3lizG6ekO4ohGEcDX46iQHbT9fatC9q28dynceMI2CXo3LIe7eC51CBE4hyEbBSirogBbAIvmc84HJWIOaDd_TBogJtK1G1XaMs/clip_image0026.jpg" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="clip_image002" alt="clip_image002" src="https://u8hm0q.bay.livefilestore.com/y1m9zyRlqVCkIz5vfghasnfNZ_eXqO6WObXnEFM0wjEC29QfjsZ4ILf3ARUBz_GCBcoIAO1gnS0eluiRLGomQAR1zLzxngRssHh8QoQNCFWedPzng_eoUZRlpS8v3IjBdZ_49RrYf2UlhA/clip_image002_thumb3.jpg" border="0" height="364" width="304" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.3 – Custom properties&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I have created &lt;strong&gt;seven&lt;/strong&gt; custom properties for this demo. &lt;strong&gt;Four&lt;/strong&gt; are of type &lt;strong&gt;Text&lt;/strong&gt;: Forename, Username, HomeAddress and FreeGift. &lt;strong&gt;One&lt;/strong&gt; is of type &lt;strong&gt;Number&lt;/strong&gt;: PleaseWaitNDays. &lt;strong&gt;One&lt;/strong&gt; is of type &lt;strong&gt;Date&lt;/strong&gt;: GiftArrivalDate. &lt;strong&gt;One&lt;/strong&gt; is of type &lt;strong&gt;Yes or no&lt;/strong&gt;: RecieveFurtherMail.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Once you have defined custom properties you can use them through your document by selecting ”Insert -&amp;gt; Quick Parts -&amp;gt; Field…”&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mhzjWn1MrvAJ-e-pu2KgRmf9q6pmNA66gVKMObEp8neHTIe5kudjas1jbw5Zw3f91hcATcQHdFO_3817iMUuOQRerdoAqYafEyUwPaJYcP34jqh6xW1ca0ndEhj4POh8FBi9E7ji0yvQ/image33.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mCxkBIwAojWuZRk8KfkUqm6DtH4IlftDW0fbVyJUF5kijwpXo4B_R6yqiEueIDTpA_Ihsl3rYdG4-SnilIlvAIByzcNQnV2XioPcYGiOBZz-ERq5OocImFL1nmSd8oEfOZud_FlEOoxI/image_thumb16.png" border="0" height="109" width="506" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.4 – Insert –&gt; Quick Parts –&gt; Field…&lt;/strong&gt;  &lt;/span&gt;&lt;/p&gt;&lt;p&gt;If you double click on one of your custom properties, it will appear in the document at the current carrot position.&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1m6H6f1TNpNjAs5Vf69Rx3_8c17bLrpTRVUcwyMY5GBy0BlPTJhhT4m3Rak-ja5fvrNyIUpLrUcK02HYQyJIoaGxOZt1t3Fjci7EyO-2MSENoyxbLMzrU7RZMJWOtKwO6WOAeYGdvPSRU/image37.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1meoSioKLQRegvgH4ZmVnL345_Nif9Tdlcl3ZhNgWLbocIUQ7z0b3QDIwchp5y60wgh1zvIhlzTmSSZoEyA-0bn4GOKhJ6pFnKxYMktZd2NvE2h-lVcsgHggtFaAXtfm0PgbNrggxhmJI/image_thumb18.png" border="0" height="337" width="506" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.5 – Select custom property&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The following document is a welcome letter that will be sent to all new users who subscribe to the factious magazine called “Home Appliances. The letter which includes the &lt;strong&gt;seven&lt;/strong&gt; custom properties listed above looks as follows.&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mNX7s9OHsa0bkISUeQhMXd-dbwJcn1qL_j0nqwpbBbT-YxmnfzDkkYRnEdDFPCcN5DukGEx19hN-t_2aqRYgwe1IJ8K20B2RxbaDws6OrUan2n_u-BgHtASZTDUCzf-5O-TE3GdWNoCY/image41.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mvB-hANqsai4hAEQdzhMaylLkuJaEG5APOr0sGJaLZRBn8p74oVuqqUST4jTErbQbwugev_VbuchRXQ0OayxXJtcRg0MDI2t6vq-H7VZVB_d7B2HXCVxAAy3khjKlMyWmJdUjtGs-KWQ/image_thumb20.png" border="0" height="362" width="506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.6 &lt;/strong&gt;- &lt;b&gt;Factious magazine welcome letter&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Setting values custom properties for this document is a trivial task using DocX.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="color:green;"&gt;// This class represents a user&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;class &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;User&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;   &lt;span style="color:blue;"&gt;public string &lt;/span&gt;forname, surname, username, freeGift, HomeAddress;&lt;br /&gt;   &lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;DateTime &lt;/span&gt;joined;&lt;br /&gt;   &lt;span style="color:blue;"&gt;public bool &lt;/span&gt;RecieveFurtherMail;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:blue;"&gt;public &lt;/span&gt;User()&lt;br /&gt;   { }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;static void &lt;/span&gt;Main(&lt;span style="color:blue;"&gt;string&lt;/span&gt;[] args)&lt;br /&gt;{&lt;br /&gt;   &lt;span style="color:green;"&gt;// A list which contains three new users&lt;br /&gt;   &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;User&lt;/span&gt;&amp;gt; newUsers = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;User&lt;/span&gt;&amp;gt;&lt;br /&gt;   {&lt;br /&gt;       &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;User&lt;br /&gt;       &lt;/span&gt;{&lt;br /&gt;           forname = &lt;span style="color: rgb(163, 21, 21);"&gt;"John"&lt;/span&gt;, surname = &lt;span style="color: rgb(163, 21, 21);"&gt;"Smith"&lt;/span&gt;, username = &lt;span style="color: rgb(163, 21, 21);"&gt;"John87"&lt;/span&gt;,&lt;br /&gt;           freeGift = &lt;span style="color: rgb(163, 21, 21);"&gt;"toaster"&lt;/span&gt;, joined = &lt;span style="color: rgb(43, 145, 175);"&gt;DateTime&lt;/span&gt;.Now,&lt;br /&gt;           HomeAddress = &lt;span style="color: rgb(163, 21, 21);"&gt;"21 Hillview, Naas, Co. Kildare"&lt;/span&gt;,&lt;br /&gt;           RecieveFurtherMail = &lt;span style="color:blue;"&gt;true&lt;br /&gt;       &lt;/span&gt;},&lt;br /&gt;   &lt;br /&gt;       &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;User&lt;br /&gt;       &lt;/span&gt;{&lt;br /&gt;           forname = &lt;span style="color: rgb(163, 21, 21);"&gt;"James"&lt;/span&gt;, surname = &lt;span style="color: rgb(163, 21, 21);"&gt;"O'Brian"&lt;/span&gt;, username = &lt;span style="color: rgb(163, 21, 21);"&gt;"KingJames"&lt;/span&gt;,&lt;br /&gt;           freeGift = &lt;span style="color: rgb(163, 21, 21);"&gt;"kitchen knife"&lt;/span&gt;, joined = &lt;span style="color: rgb(43, 145, 175);"&gt;DateTime&lt;/span&gt;.Now,&lt;br /&gt;           HomeAddress = &lt;span style="color: rgb(163, 21, 21);"&gt;"37 Mill Lane, Maynooth, Co. Meath"&lt;/span&gt;,&lt;br /&gt;           RecieveFurtherMail = &lt;span style="color:blue;"&gt;false&lt;br /&gt;       &lt;/span&gt;},&lt;br /&gt;   &lt;br /&gt;       &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;User&lt;br /&gt;       &lt;/span&gt;{&lt;br /&gt;           forname = &lt;span style="color: rgb(163, 21, 21);"&gt;"Mary"&lt;/span&gt;, surname = &lt;span style="color: rgb(163, 21, 21);"&gt;"McNamara"&lt;/span&gt;, username = &lt;span style="color: rgb(163, 21, 21);"&gt;"McNamara1"&lt;/span&gt;,&lt;br /&gt;           freeGift = &lt;span style="color: rgb(163, 21, 21);"&gt;"microwave"&lt;/span&gt;, joined = &lt;span style="color: rgb(43, 145, 175);"&gt;DateTime&lt;/span&gt;.Now,&lt;br /&gt;           HomeAddress = &lt;span style="color: rgb(163, 21, 21);"&gt;"110 Cherry Orchard Drive, Navan, Co. Roscommon"&lt;/span&gt;, RecieveFurtherMail= &lt;span style="color:blue;"&gt;true&lt;br /&gt;       &lt;/span&gt;}&lt;br /&gt;   };&lt;br /&gt;&lt;br /&gt;   &lt;span style="color:green;"&gt;// Foreach of the three new user create a welcome document based on template.docx&lt;br /&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;foreach &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;User &lt;/span&gt;newUser &lt;span style="color:blue;"&gt;in &lt;/span&gt;newUsers)&lt;br /&gt;   {&lt;br /&gt;       &lt;span style="color:green;"&gt;/*&lt;br /&gt;        * Load the template to be manipulated and set the custom properties to this&lt;br /&gt;        * users specific data&lt;br /&gt;        */&lt;br /&gt;       &lt;/span&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;DocX &lt;/span&gt;doc = &lt;span style="color: rgb(43, 145, 175);"&gt;DocX&lt;/span&gt;.Load(&lt;span style="color: rgb(163, 21, 21);"&gt;"Template.docx"&lt;/span&gt;))&lt;br /&gt;       {&lt;br /&gt;           doc.AddCustomProperty(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"Forname"&lt;/span&gt;, newUser.forname));&lt;br /&gt;           doc.AddCustomProperty(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"Username"&lt;/span&gt;, newUser.username));&lt;br /&gt;           doc.AddCustomProperty(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"FreeGift"&lt;/span&gt;, newUser.freeGift));&lt;br /&gt;           doc.AddCustomProperty(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"HomeAddress"&lt;/span&gt;, newUser.HomeAddress));&lt;br /&gt;           doc.AddCustomProperty(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"PleaseWaitNDays"&lt;/span&gt;, 4));&lt;br /&gt;           doc.AddCustomProperty(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"GiftArrivalDate"&lt;/span&gt;, newUser.joined.AddDays(4).ToUniversalTime()));&lt;br /&gt;           doc.AddCustomProperty(&lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;CustomProperty&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"RecieveFurtherMail"&lt;/span&gt;, newUser.RecieveFurtherMail));&lt;br /&gt;&lt;br /&gt;           &lt;span style="color:green;"&gt;// Save this document as the users name followed by .docx&lt;br /&gt;           &lt;/span&gt;doc.SaveAs(&lt;span style="color:blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(163, 21, 21);"&gt;@"{0}.docx"&lt;/span&gt;, newUser.username));&lt;br /&gt;       }&lt;span style="color:green;"&gt;// Release this document from memory&lt;br /&gt;   &lt;/span&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;The above code will generate three docx files&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1mpip3JdDiAGnuBfoGDVGJ_Q1aQi8kmf5erq4pDY9I5WzlKyIpNr7Qd9Cl00GsrzYFbnaQmviKIHUuueunDIfVV3pIu1e_WOqDyfzBxrKxxY1iElHl5TWyGXy-0NMHNZj0peCgtrM4aWE/image48.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mxYZ2L9AG9K5EgDNJrtUs70G6LJl8M8KB7pEPO5Nv1KfqTjRbLWR3jW7krR5QFn3dHgHAm6DYjBsYDfDsB6VPftp2dotUMPr_0T_nYUFQZ6IZxe1rHd408jLSVGYde51pb13rDxtx4EY/image_thumb23.png" border="0" height="228" width="506" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.7 – &lt;/strong&gt;&lt;strong&gt;John87.docx&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1midTzqIAtxVtH5ae51NTs5HdIyb8Z5sk7ZSimF0ETc3IjOX_ws-4-CPzXy0TI-pK7r6tkCIhzxoWZetL2cR-KC9ZD_uN0wr9s1ZOwdtCEtXXI-AY39rUdRhyv0C3sNrt1EzmPa53ZyDQ/image60.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1m368NbHqSUq3f_T3Iwuh4XDVzCr4pKFTNF-GCZu3T-LXNhUMiTJIg0zbc_-qgF0q8rv1QKDHnGjNK4xQvZ3brAum6033X7q3U2pw3b7D1pf1nhfAYWSIq9NTbjh8In0rrp7KBygjlyx4/image_thumb29.png" border="0" height="228" width="506" /&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.8 – KingJames.docx&lt;/strong&gt;  &lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;a href="https://u8hm0q.bay.livefilestore.com/y1miM_IU77iAYLfQaa4lLiyblRfAIk9AtzExXuVmb9Z5T4eSqSu4h76ZfxgyBXcFVKKuTpe22rNHwEPDaF7cd3W5XMOq0YJ7VRZoAilq41fb0yt-reErfWnwb2zTCz6BqoSjZ8IJFZBhhQ/image64.png" rel="WLPP"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="https://u8hm0q.bay.livefilestore.com/y1mSuExwuFish7YGgOtJbWxzkMb7l7JnkemHQpzFF-aDRR7vDb4Bqjs-DJ7MvCfTPW3bOC-mb-CQXcpAkmBLnPvfQSY9_SGq76rPyGL0alhB3IvZee6R2IrihEBbeW_7LRtfsMfLqPytNQ/image_thumb31.png" border="0" height="228" width="506" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;Figure 2.9 – &lt;/strong&gt;&lt;strong&gt;McNamara1.docx&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;-----------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you would like to give me feedback on my library DocX, please either post a comment here or email me @ &lt;a href="mailto:coffey.cathal@gmail.com"&gt;coffey.cathal@gmail.com&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Happy coding,&lt;br /&gt;Cathal&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1138151560829907108-8445547926217989901?l=cathalscorner.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_pNECalR8MLribrZBKwd7dwwPe0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_pNECalR8MLribrZBKwd7dwwPe0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_pNECalR8MLribrZBKwd7dwwPe0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_pNECalR8MLribrZBKwd7dwwPe0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/CathalsCorner/~4/T2gMIz6PmO0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/CathalsCorner/~3/T2gMIz6PmO0/docx-net-library-for-manipulating-word.html</link><author>noreply@blogger.com (Cathal Coffey)</author><thr:total>4</thr:total><feedburner:origLink>http://cathalscorner.blogspot.com/2009/02/docx-net-library-for-manipulating-word.html</feedburner:origLink></item><language>en-us</language><media:rating>nonadult</media:rating></channel></rss>

