<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>PowerTools for Open XML</title><link>http://powertools.codeplex.com/project/feeds/rss</link><description>The PowerTools for Open XML are a set of sample cmdlets and guidance for processing Open XML documents on a server using PowerShell.</description><item><title>New Post: Lost image after convert docx to html.</title><link>http://powertools.codeplex.com/discussions/60600</link><description>&lt;div style="line-height: normal;"&gt;I am also facing same problem. Images are not converted while converting word document to HTML.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;
I can not use the (.DOC) file for conversion to HTML - Exception - File contains corrupted data.&lt;br /&gt;
So, I have to use the (.DOCX) files for conversion to HTML. Is this the limitation?&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;
If file contains some images it is not correctly converted. If I Open the HTML file in browser.I can not see the images&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
Following code I am using -&lt;br /&gt;
&lt;br /&gt;
public static void ConvertToHTMLUsingOpenXml(string fUpload, string htmlFile, string imagePath)&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;   {

       string sourceDocumentFileName = fUpload;

       string imageDirectoryName = Path.GetFileNameWithoutExtension(sourceDocumentFileName) + &amp;quot;_files&amp;quot;;

       int imageCounter = 0;

       byte[] byteArray = File.ReadAllBytes(sourceDocumentFileName);

       using (MemoryStream memoryStream = new MemoryStream())

       {

           memoryStream.Write(byteArray, 0, byteArray.Length);

           WordprocessingDocument doc =

               WordprocessingDocument.Open(memoryStream, true);

           {

               HtmlConverterSettings settings = new HtmlConverterSettings()

               {

                   PageTitle = Path.GetFileNameWithoutExtension(sourceDocumentFileName),

                   ConvertFormatting = true,

               };

               XElement html = HtmlConverter.ConvertToHtml(doc, settings,

                   imageInfo =&amp;gt;

                   {

                       DirectoryInfo localDirInfo = new DirectoryInfo(imagePath + imageDirectoryName);//Server.MapPath(HTML_FILE_PATH + imageDirectoryName));

                       if (!localDirInfo.Exists)

                           localDirInfo.Create();

                       ++imageCounter;

                       string extension = imageInfo.ContentType.Split('/')[1].ToLower();

                       ImageFormat imageFormat = null;

                       if (extension == &amp;quot;png&amp;quot;)

                       {

                           extension = &amp;quot;jpeg&amp;quot;;

                           imageFormat = ImageFormat.Jpeg;

                       }

                       else if (extension == &amp;quot;bmp&amp;quot;)

                           imageFormat = ImageFormat.Bmp;

                       else if (extension == &amp;quot;jpeg&amp;quot;)

                           imageFormat = ImageFormat.Jpeg;

                       else if (extension == &amp;quot;tiff&amp;quot;)

                           imageFormat = ImageFormat.Tiff;

                        if (imageFormat == null)

                           return null;

                        string imageFileName = imagePath+ imageDirectoryName + &amp;quot;\\image&amp;quot; + // Server.MapPath(HTML_FILE_PATH + imageDirectoryName) + &amp;quot;/image&amp;quot; +

                            imageCounter.ToString() + &amp;quot;.&amp;quot; + extension;

                       try

                       {

                           imageInfo.Bitmap.Save(imageFileName, imageFormat);

                       }

                       catch (System.Runtime.InteropServices.ExternalException)

                       {

                           return null;

                       }

                       XElement img = new XElement(Xhtml.img,

                           new XAttribute(NoNamespace.src, imageFileName),

                           imageInfo.ImgStyleAttribute,

                           imageInfo.AltText != null ?

                               new XAttribute(NoNamespace.alt, imageInfo.AltText) : null);

                       return img;

                   });

               File.WriteAllText(htmlFile, html.ToString());

           }

           memoryStream.Close();

       }

   }&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;</description><author>akshay904</author><pubDate>Thu, 09 May 2013 06:27:26 GMT</pubDate><guid isPermaLink="false">New Post: Lost image after convert docx to html. 20130509062726A</guid></item><item><title>Updated Release: PowerTools for OpenXML 2.2 (Jan 22, 2012)</title><link>https://powertools.codeplex.com/releases/view/74771</link><description>&lt;div class="wikidoc"&gt;May 7, 2013 - Updated PresentationBuilder - fixed bug where it could create an invalid presentation.&lt;br /&gt;&lt;br /&gt;January 14, 2013 - Added PresentationBuilder.&lt;br /&gt;&lt;br /&gt;November 4, 2012 - Added spreadsheet formula example.&lt;br /&gt;&lt;br /&gt;October 25, 2012 - Fixed some problems with the pivot table configuration and getting cell values.&lt;br /&gt;&lt;br /&gt;April 29, 2012 - Added pivot table configuration of rows, columns, filters and data values.&lt;br /&gt;&lt;br /&gt;April 23, 2012 - Updated spreadsheet cell styles with lots of options.&lt;br /&gt;&lt;br /&gt;March 25, 2012 - New spreadsheet data generation with cell styles.&lt;br /&gt;&lt;br /&gt;Feb 8, 2012 - Patched problem with PowerTools Core 2.2.2&lt;br /&gt;&lt;br /&gt;Version 2.2 of the source code.&lt;br /&gt;&lt;br /&gt;Oct 25, 2011 - added DocumentBuilder-2-0.zip.  There is a minor bug fix to code that merges documents that contain numbered items.&lt;br /&gt;&lt;br /&gt;Nov 9, 2011 - added Core code with examples of how to use from your own C# program.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>EricWhiteDpe</author><pubDate>Tue, 07 May 2013 16:41:14 GMT</pubDate><guid isPermaLink="false">Updated Release: PowerTools for OpenXML 2.2 (Jan 22, 2012) 20130507044114P</guid></item><item><title>Released: PowerTools for OpenXML 2.2 (Jan 22, 2012)</title><link>http://powertools.codeplex.com/releases/view/74771</link><description>
&lt;div class="wikidoc"&gt;May 7, 2013 - Updated PresentationBuilder - fixed bug where it could create an invalid presentation.&lt;br&gt;
&lt;br&gt;
January 14, 2013 - Added PresentationBuilder.&lt;br&gt;
&lt;br&gt;
November 4, 2012 - Added spreadsheet formula example.&lt;br&gt;
&lt;br&gt;
October 25, 2012 - Fixed some problems with the pivot table configuration and getting cell values.&lt;br&gt;
&lt;br&gt;
April 29, 2012 - Added pivot table configuration of rows, columns, filters and data values.&lt;br&gt;
&lt;br&gt;
April 23, 2012 - Updated spreadsheet cell styles with lots of options.&lt;br&gt;
&lt;br&gt;
March 25, 2012 - New spreadsheet data generation with cell styles.&lt;br&gt;
&lt;br&gt;
Feb 8, 2012 - Patched problem with PowerTools Core 2.2.2&lt;br&gt;
&lt;br&gt;
Version 2.2 of the source code.&lt;br&gt;
&lt;br&gt;
Oct 25, 2011 - added DocumentBuilder-2-0.zip. There is a minor bug fix to code that merges documents that contain numbered items.&lt;br&gt;
&lt;br&gt;
Nov 9, 2011 - added Core code with examples of how to use from your own C# program.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
</description><author></author><pubDate>Tue, 07 May 2013 16:41:14 GMT</pubDate><guid isPermaLink="false">Released: PowerTools for OpenXML 2.2 (Jan 22, 2012) 20130507044114P</guid></item><item><title>Updated Release: PowerTools for OpenXML 2.2 (Jan 22, 2012)</title><link>https://powertools.codeplex.com/releases/view/74771</link><description>&lt;div class="wikidoc"&gt;January 14, 2013 - Added PresentationBuilder.&lt;br /&gt;&lt;br /&gt;November 4, 2012 - Added spreadsheet formula example.&lt;br /&gt;&lt;br /&gt;October 25, 2012 - Fixed some problems with the pivot table configuration and getting cell values.&lt;br /&gt;&lt;br /&gt;April 29, 2012 - Added pivot table configuration of rows, columns, filters and data values.&lt;br /&gt;&lt;br /&gt;April 23, 2012 - Updated spreadsheet cell styles with lots of options.&lt;br /&gt;&lt;br /&gt;March 25, 2012 - New spreadsheet data generation with cell styles.&lt;br /&gt;&lt;br /&gt;Feb 8, 2012 - Patched problem with PowerTools Core 2.2.2&lt;br /&gt;&lt;br /&gt;Version 2.2 of the source code.&lt;br /&gt;&lt;br /&gt;Oct 25, 2011 - added DocumentBuilder-2-0.zip.  There is a minor bug fix to code that merges documents that contain numbered items.&lt;br /&gt;&lt;br /&gt;Nov 9, 2011 - added Core code with examples of how to use from your own C# program.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>EricWhiteDpe</author><pubDate>Tue, 07 May 2013 16:39:57 GMT</pubDate><guid isPermaLink="false">Updated Release: PowerTools for OpenXML 2.2 (Jan 22, 2012) 20130507043957P</guid></item><item><title>Updated Release: PowerTools for OpenXML 2.2 (Jan 22, 2012)</title><link>https://powertools.codeplex.com/releases/view/74771</link><description>&lt;div class="wikidoc"&gt;January 14, 2013 - Added PresentationBuilder.&lt;br /&gt;&lt;br /&gt;November 4, 2012 - Added spreadsheet formula example.&lt;br /&gt;&lt;br /&gt;October 25, 2012 - Fixed some problems with the pivot table configuration and getting cell values.&lt;br /&gt;&lt;br /&gt;April 29, 2012 - Added pivot table configuration of rows, columns, filters and data values.&lt;br /&gt;&lt;br /&gt;April 23, 2012 - Updated spreadsheet cell styles with lots of options.&lt;br /&gt;&lt;br /&gt;March 25, 2012 - New spreadsheet data generation with cell styles.&lt;br /&gt;&lt;br /&gt;Feb 8, 2012 - Patched problem with PowerTools Core 2.2.2&lt;br /&gt;&lt;br /&gt;Version 2.2 of the source code.&lt;br /&gt;&lt;br /&gt;Oct 25, 2011 - added DocumentBuilder-2-0.zip.  There is a minor bug fix to code that merges documents that contain numbered items.&lt;br /&gt;&lt;br /&gt;Nov 9, 2011 - added Core code with examples of how to use from your own C# program.&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>EricWhiteDpe</author><pubDate>Tue, 07 May 2013 16:37:50 GMT</pubDate><guid isPermaLink="false">Updated Release: PowerTools for OpenXML 2.2 (Jan 22, 2012) 20130507043750P</guid></item><item><title>New Post: PowerTools 2.2 source code cannot be Referenced in another project</title><link>http://powertools.codeplex.com/discussions/442330</link><description>&lt;div style="line-height: normal;"&gt;Himanshu,&lt;br /&gt;
&lt;br /&gt;
I am not sure but adding references to &amp;quot;DocumentFormat.OpenXml&amp;quot; and &amp;quot;WindowsBase&amp;quot; apart from OpenXmlPowerTools dll in your project can resolve your issue.&lt;br /&gt;
&lt;br /&gt;
-- Fenil.&lt;br /&gt;
&lt;/div&gt;</description><author>fenilrathod</author><pubDate>Mon, 06 May 2013 12:18:47 GMT</pubDate><guid isPermaLink="false">New Post: PowerTools 2.2 source code cannot be Referenced in another project 20130506121847P</guid></item><item><title>New Post: PowerTools 2.2 source code cannot be Referenced in another project</title><link>http://powertools.codeplex.com/discussions/442330</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
I'm trying to use the PowerTools 2.2 in my project, I need to use the MarkupSimplifier class as in Eric's blog post - &lt;a href="http://ericwhite.com/blog/2011/03/09/getting-started-with-open-xml-powertools-markup-simplifier" rel="nofollow"&gt;http://ericwhite.com/blog/2011/03/09/getting-started-with-open-xml-powertools-markup-simplifier&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I’m using it with Visual Studio 2010 in the source code. I’ve included the PowerTools 2.2 project that I downloaded from codeplex to my solution and then added the reference to OpenXmlPowerTools in my project so I can use MarkupSimplifier.&lt;br /&gt;
When I try to debug the solution initially it loads fine but later gives an exception:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;System.IO.FileNotFoundException was caught
Message=Could not load file or assembly ‘OpenXmlPowerTools, Version=2.2.0.0, Culture=neutral, PublicKeyToken=981466f262afc448′ or one of its dependencies. The system cannot find the file specified.
I’m really stumped, I’ve tried adding reference to only the OpenXmlPowerTools DLL but that doesn’t seem to work either and gives same message.&lt;/code&gt;&lt;/pre&gt;

Also, I’m using Windows Server 2008 R2, and Sharepoint 2010 with Powershell 2.0&lt;br /&gt;
&lt;br /&gt;
Not sure what might be causing the exceptions? &lt;br /&gt;
Please could someone help.&lt;br /&gt;
&lt;br /&gt;
Many thanks&lt;br /&gt;
Himanshu&lt;br /&gt;
&lt;/div&gt;</description><author>maverickht</author><pubDate>Thu, 02 May 2013 12:02:44 GMT</pubDate><guid isPermaLink="false">New Post: PowerTools 2.2 source code cannot be Referenced in another project 20130502120244P</guid></item><item><title>Created Issue: ArgumentNullException in RevisionAccepter [10961]</title><link>http://powertools.codeplex.com/workitem/10961</link><description>In RevisionAccepter in method AddBlockLevelContentControls the tools throws ArgumentNullException when there is a content control &amp;#40;sdt&amp;#41; without runs. There is this comment in the code that shows this to be a known issue&amp;#58;&lt;br /&gt;                &amp;#47;&amp;#47; TODO - Need a slight modification here.  If there is a paragraph&lt;br /&gt;                &amp;#47;&amp;#47; in the content control that contains no runs, then because the paragraph isn&amp;#39;t included in the&lt;br /&gt;                &amp;#47;&amp;#47; content control, because the following triggers off of runs.&lt;br /&gt;                &amp;#47;&amp;#47; To see an example of this, see example document &amp;#34;NumberingParagraphPropertiesChange.docxs&amp;#34;&lt;br /&gt;&lt;br /&gt;I report it here anyway because I found no existing issue with this information. My workaround is to insert this line&amp;#58;&lt;br /&gt;&lt;br /&gt;          if &amp;#40;runsInNewDocument.Count&amp;#61;&amp;#61;0&amp;#41; continue&amp;#59;&lt;br /&gt;&lt;br /&gt;just after the line &amp;#34;var runsInNewDocument &amp;#61; ...&amp;#34;&lt;br /&gt;It is most certainly not an entirely correct solution, but it makes the tools not break in this case.&lt;br /&gt;&lt;br /&gt;I hope this helps someone until the problem is fixed properly.&lt;br /&gt;&lt;br /&gt;The whole class of the RevisionAccepter seems overly complex to me. I find the process of tagging and copying content hard to grasp and I suspect it could have been done much simpler.&lt;br /&gt;&lt;br /&gt;Thanks.&lt;br /&gt;</description><author>Jcoolsen</author><pubDate>Thu, 02 May 2013 11:04:14 GMT</pubDate><guid isPermaLink="false">Created Issue: ArgumentNullException in RevisionAccepter [10961] 20130502110414A</guid></item><item><title>New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder</title><link>http://powertools.codeplex.com/discussions/440028</link><description>&lt;div style="line-height: normal;"&gt;Hi Eric,&lt;br /&gt;
&lt;br /&gt;
I've just resolve the issue by making the unique ids for all the shape, shapeTypes and objects associates with each other. And this simple solution have resolve my issue. Below is the code, Let me know if anything is unusual.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt; private static void FixUpEmbeddedObjectIds(WordprocessingDocument outputWPDocument)
 {
     foreach (EmbeddedObject obj in outputWPDocument.MainDocumentPart.Document.Descendants&amp;lt;EmbeddedObject&amp;gt;())
     {
         var shapeType = obj.Descendants&amp;lt;DocumentFormat.OpenXml.Vml.Shapetype&amp;gt;().FirstOrDefault();
         var shape = obj.Descendants&amp;lt;DocumentFormat.OpenXml.Vml.Shape&amp;gt;().FirstOrDefault();
         var oleObject = obj.Descendants&amp;lt;OleObject&amp;gt;().FirstOrDefault();

         if (shapeType != null &amp;amp;&amp;amp; shape != null)
         {
             shapeType.Id = Guid.NewGuid().ToString();
             shape.Type = shapeType.Id;
         }
         if (shape != null &amp;amp;&amp;amp; oleObject != null)
         {
             shape.Id = Guid.NewGuid().ToString();
             oleObject.ShapeId = shape.Id;
         }
     }
 }&lt;/code&gt;&lt;/pre&gt;

Cheers,&lt;br /&gt;
Fenil.&lt;br /&gt;
&lt;/div&gt;</description><author>fenilrathod</author><pubDate>Wed, 24 Apr 2013 12:02:00 GMT</pubDate><guid isPermaLink="false">New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder 20130424120200P</guid></item><item><title>New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder</title><link>http://powertools.codeplex.com/discussions/440028</link><description>&lt;div style="line-height: normal;"&gt;In DocumentBuilder, you will find a class that it uses to prevent duplication of images.  The correct approach is to make a variation of that class that prevents duplication of the OleObject.  The code will be almost identical.  It could be possible to modify the class to prevent image duplication so that it prevents duplication of multiple types of things, i.e. images and OleObjects, but it is a small class and it is probably more effort that it is worth.  I would probably just create a new class that is nearly identical to that one.&lt;br /&gt;
&lt;br /&gt;
Cheers, Eric&lt;br /&gt;
&lt;/div&gt;</description><author>EricWhiteDpe</author><pubDate>Fri, 12 Apr 2013 19:46:31 GMT</pubDate><guid isPermaLink="false">New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder 20130412074631P</guid></item><item><title>New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder</title><link>http://powertools.codeplex.com/discussions/440028</link><description>&lt;div style="line-height: normal;"&gt;Thanks again for your quick response. &lt;br /&gt;
&lt;br /&gt;
Today, After investigating further I found that during merging, OleObjects getting duplicated with same id with duplicated shape and shapetypes as well. Probably that could be an issue.&lt;br /&gt;
&lt;br /&gt;
I'll look into it further and will try to solve it if possible.&lt;br /&gt;
&lt;br /&gt;
If you can provide any suggestions it will be helpful.&lt;br /&gt;
&lt;br /&gt;
Thanks again for your time.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Fenil.&lt;br /&gt;
&lt;/div&gt;</description><author>fenilrathod</author><pubDate>Fri, 12 Apr 2013 17:38:16 GMT</pubDate><guid isPermaLink="false">New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder 20130412053816P</guid></item><item><title>New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder</title><link>http://powertools.codeplex.com/discussions/440028</link><description>&lt;div style="line-height: normal;"&gt;I haven't done the analysis of what would be required to support OleObjects.  There probably should be some check to make sure that the same OleObject isn't duplicated in the destination document.  Then to test a number of scenarios, making sure all bases are covered.&lt;br /&gt;
&lt;br /&gt;
It will be some time before I can get to this.  I am over-booked for the next 2 1/2 months.&lt;br /&gt;
&lt;br /&gt;
I do have PowerTools on my agenda, and that includes some important enhancements to DocumentBuilder.&lt;br /&gt;
&lt;br /&gt;
Cheers, Eric&lt;br /&gt;
&lt;/div&gt;</description><author>EricWhiteDpe</author><pubDate>Fri, 12 Apr 2013 17:03:17 GMT</pubDate><guid isPermaLink="false">New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder 20130412050317P</guid></item><item><title>New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder</title><link>http://powertools.codeplex.com/discussions/440028</link><description>&lt;div style="line-height: normal;"&gt;Thanks Eric for the response.&lt;br /&gt;
&lt;br /&gt;
I guess DocumentBuilder supporting OleObjects and I've successfully able to merge OleObjects(Linked Objects, e.g, Excel file) if they are in only one source document. &lt;br /&gt;
&lt;br /&gt;
But as soon as multiple documents have OleObjects, after merging they links of OleObjects are getting broken apart from the first OleObject in the document. If possible I could share demo application for this issue.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Fenil.&lt;br /&gt;
&lt;/div&gt;</description><author>fenilrathod</author><pubDate>Fri, 12 Apr 2013 13:16:16 GMT</pubDate><guid isPermaLink="false">New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder 20130412011616P</guid></item><item><title>New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder</title><link>http://powertools.codeplex.com/discussions/440028</link><description>&lt;div style="line-height: normal;"&gt;Hi Fenil,&lt;br /&gt;
&lt;br /&gt;
That is an issue with DocumentBuilder.  Currently it does not support merging documents that reference OleObjects.  It is a great idea for a future enhancement.&lt;br /&gt;
&lt;br /&gt;
Regards, Eric&lt;br /&gt;
&lt;/div&gt;</description><author>EricWhiteDpe</author><pubDate>Fri, 12 Apr 2013 09:51:56 GMT</pubDate><guid isPermaLink="false">New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder 20130412095156A</guid></item><item><title>New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder</title><link>http://powertools.codeplex.com/discussions/440028</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
&lt;br /&gt;
I'm getting issues during merging multiple documents having OleObjects (Linked Objects) having external relationships to files using DocumentBuilder.&lt;br /&gt;
&lt;br /&gt;
You can reproduce this issue by having multiple linked objects in it and try to merge them using DocumentBuilder. &lt;br /&gt;
&lt;br /&gt;
As a result you will have a merged document with OleObjects with broken external relationship and you will no longer able to update those objects by clicking them.&lt;br /&gt;
&lt;br /&gt;
I just want to know if this is the issue with DocumentBuilder or I am doing something wrong?&lt;br /&gt;
&lt;br /&gt;
Fenil.&lt;br /&gt;
&lt;/div&gt;</description><author>fenilrathod</author><pubDate>Fri, 12 Apr 2013 07:42:23 GMT</pubDate><guid isPermaLink="false">New Post: Multiple OleObjects (Linked Objects) are not getting merged properly using DocumentBuilder 20130412074223A</guid></item><item><title>Commented Issue: Style numbering disappear after merge [10590]</title><link>http://powertools.codeplex.com/workitem/10590</link><description>I have word document X.docx. I get a list of elements from it and try to insert to another document Y.docx via powertools DocumentBuilder.BuildDocument. In case I apply style to paragraph &amp;#40;X.docx&amp;#41; which contain numbering in StyleDefinitionsPart, after merging I lose all numbering in resulting document. &lt;br /&gt;Document.xml&lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;When is necessary to use &amp;#8230; &amp;#63;&lt;br /&gt;&lt;br /&gt;&amp;#8211;&lt;br /&gt;Style.xml&lt;br /&gt;&lt;br /&gt;. . .&lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In result I get document where style referring to numId , but there no element w&amp;#58;num with this numId in NumberingPart&lt;br /&gt;&lt;br /&gt;DocumentBuilder.BuildDocument&lt;br /&gt;1&amp;#41; void CopyStartingParts &amp;#40;&amp;#8230;&amp;#41;&lt;br /&gt;&amp;#123;&amp;#8230;&lt;br /&gt;&amp;#47;&amp;#47; Note&amp;#58; Do not copy the numbering part. For every source, create new numbering definitions from&lt;br /&gt;&amp;#47;&amp;#47; scratch.&lt;br /&gt;&amp;#47;&amp;#47;NumberingDefinitionsPart numberingPart &amp;#61; sourceDocument.MainDocumentPart.NumberingDefinitionsPart&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;Why&amp;#63;&lt;br /&gt;2&amp;#41; CopyNumbering&amp;#40;&amp;#8230;&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;foreach &amp;#40;XElement numReference in newContent.DescendantsAndSelf&amp;#40;W.numPr&amp;#41;&amp;#41;&lt;br /&gt;but it doesn&amp;#8217;t take into account the numbering in StyleDefinitionsPart&lt;br /&gt;&amp;#125;&lt;br /&gt;Comments: ** Comment from web user: HomerSimpian ** &lt;p&gt;For whatever it is worth, I have found that for my purposes and with the documents I am merging, I needed to re-instate the commented out code at line 1721 or so in DocumentBuilder.cs.  I'm not saying this is a fix for everyone, as there must be a valid reason it was commented out to begin with.  That said, it does appear to fix my problems by re-adding it in.&lt;/p&gt;&lt;p&gt;Without it, I am missing the numbering.xml entirely and my styles are no longer 'valid'.  The headings become bullets or nothing at times.  Hope this bit helps.&lt;/p&gt;</description><author>HomerSimpian</author><pubDate>Fri, 08 Mar 2013 22:00:09 GMT</pubDate><guid isPermaLink="false">Commented Issue: Style numbering disappear after merge [10590] 20130308100009P</guid></item><item><title>Commented Issue: Style numbering disappear after merge [10590]</title><link>http://powertools.codeplex.com/workitem/10590</link><description>I have word document X.docx. I get a list of elements from it and try to insert to another document Y.docx via powertools DocumentBuilder.BuildDocument. In case I apply style to paragraph &amp;#40;X.docx&amp;#41; which contain numbering in StyleDefinitionsPart, after merging I lose all numbering in resulting document. &lt;br /&gt;Document.xml&lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;When is necessary to use &amp;#8230; &amp;#63;&lt;br /&gt;&lt;br /&gt;&amp;#8211;&lt;br /&gt;Style.xml&lt;br /&gt;&lt;br /&gt;. . .&lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In result I get document where style referring to numId , but there no element w&amp;#58;num with this numId in NumberingPart&lt;br /&gt;&lt;br /&gt;DocumentBuilder.BuildDocument&lt;br /&gt;1&amp;#41; void CopyStartingParts &amp;#40;&amp;#8230;&amp;#41;&lt;br /&gt;&amp;#123;&amp;#8230;&lt;br /&gt;&amp;#47;&amp;#47; Note&amp;#58; Do not copy the numbering part. For every source, create new numbering definitions from&lt;br /&gt;&amp;#47;&amp;#47; scratch.&lt;br /&gt;&amp;#47;&amp;#47;NumberingDefinitionsPart numberingPart &amp;#61; sourceDocument.MainDocumentPart.NumberingDefinitionsPart&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;Why&amp;#63;&lt;br /&gt;2&amp;#41; CopyNumbering&amp;#40;&amp;#8230;&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;foreach &amp;#40;XElement numReference in newContent.DescendantsAndSelf&amp;#40;W.numPr&amp;#41;&amp;#41;&lt;br /&gt;but it doesn&amp;#8217;t take into account the numbering in StyleDefinitionsPart&lt;br /&gt;&amp;#125;&lt;br /&gt;Comments: ** Comment from web user: HomerSimpian ** &lt;p&gt;For whatever it is worth, I have found that for my purposes and with the documents I am merging, I needed to re-instate the commented out code at line 1721 or so in DocumentBuilder.cs.  I'm not saying this is a fix for everyone, as there must be a valid reason it was commented out to begin with.  That said, it does appear to fix my problems by re-adding it in.&lt;/p&gt;&lt;p&gt;Without it, I am missing the numbering.xml entirely and my styles are no longer 'valid'.  The headings become bullets or nothing at times.  Hope this bit helps.&lt;/p&gt;</description><author>HomerSimpian</author><pubDate>Fri, 08 Mar 2013 22:00:07 GMT</pubDate><guid isPermaLink="false">Commented Issue: Style numbering disappear after merge [10590] 20130308100007P</guid></item><item><title>New Post: Change to allow a partial importation of KeepSection</title><link>http://powertools.codeplex.com/discussions/434806</link><description>&lt;div style="line-height: normal;"&gt;Hello,&lt;br /&gt;
&lt;br /&gt;
I have tried to merge some documents but by keeping the informations of the first document. So, when I added a source for the first document I had to add True to KeepSection. For the other documents as I needed to keep the header and footer of the first document I had to put False. The problem was that a custom margin was only allowed for the content of the first document and the other documents had lost the custom margins.&lt;br /&gt;
I have made the following change (in case someone is interested : &lt;br /&gt;
In the file &lt;br /&gt;
DocumentBuilder.cs&lt;br /&gt;
Function BuildDocument&lt;br /&gt;
In the end of the function there is &lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;FixUpSectionProperties(output);
&lt;/code&gt;&lt;/pre&gt;

I have put the two lines in comment so the new code is &lt;br /&gt;
&lt;br /&gt;
 //else&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;            //    FixUpSectionProperties(output);
&lt;/code&gt;&lt;/pre&gt;

the end of the function looks like that &lt;br /&gt;
&lt;br /&gt;
if (!sources.Any(s =&amp;gt; s.KeepSections))&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;            {
                using (OpenXmlMemoryStreamDocument streamDoc = new OpenXmlMemoryStreamDocument(sources[0].WmlDocument))
                using (WordprocessingDocument doc = streamDoc.GetWordprocessingDocument())
                {
                    var sectPr = doc.MainDocumentPart.GetXDocument().Root.Element(W.body)
                        .Elements().Last();
                    if (sectPr.Name == W.sectPr)
                    {
                        AddSectionAndDependencies(doc, output, sectPr, images);
                        output.MainDocumentPart.GetXDocument().Root.Element(W.body).Add(sectPr);
                    }
                }
            }
            //else
            //    FixUpSectionProperties(output);
        }
        foreach (var part in output.GetAllParts())
            if (part.Annotation&amp;lt;XDocument&amp;gt;() != null)
                part.PutXDocument();
    }&lt;/code&gt;&lt;/pre&gt;

With this change I can keep the header / footer / margins of the first documents without losing parameters from the other ones.&lt;br /&gt;
&lt;br /&gt;
Marc&lt;br /&gt;
&lt;/div&gt;</description><author>marc_al</author><pubDate>Thu, 28 Feb 2013 07:41:59 GMT</pubDate><guid isPermaLink="false">New Post: Change to allow a partial importation of KeepSection 20130228074159A</guid></item><item><title>Commented Issue: Style numbering disappear after merge [10590]</title><link>http://powertools.codeplex.com/workitem/10590</link><description>I have word document X.docx. I get a list of elements from it and try to insert to another document Y.docx via powertools DocumentBuilder.BuildDocument. In case I apply style to paragraph &amp;#40;X.docx&amp;#41; which contain numbering in StyleDefinitionsPart, after merging I lose all numbering in resulting document. &lt;br /&gt;Document.xml&lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;When is necessary to use &amp;#8230; &amp;#63;&lt;br /&gt;&lt;br /&gt;&amp;#8211;&lt;br /&gt;Style.xml&lt;br /&gt;&lt;br /&gt;. . .&lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;- &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In result I get document where style referring to numId , but there no element w&amp;#58;num with this numId in NumberingPart&lt;br /&gt;&lt;br /&gt;DocumentBuilder.BuildDocument&lt;br /&gt;1&amp;#41; void CopyStartingParts &amp;#40;&amp;#8230;&amp;#41;&lt;br /&gt;&amp;#123;&amp;#8230;&lt;br /&gt;&amp;#47;&amp;#47; Note&amp;#58; Do not copy the numbering part. For every source, create new numbering definitions from&lt;br /&gt;&amp;#47;&amp;#47; scratch.&lt;br /&gt;&amp;#47;&amp;#47;NumberingDefinitionsPart numberingPart &amp;#61; sourceDocument.MainDocumentPart.NumberingDefinitionsPart&amp;#59;&lt;br /&gt;&amp;#125;&lt;br /&gt;Why&amp;#63;&lt;br /&gt;2&amp;#41; CopyNumbering&amp;#40;&amp;#8230;&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;foreach &amp;#40;XElement numReference in newContent.DescendantsAndSelf&amp;#40;W.numPr&amp;#41;&amp;#41;&lt;br /&gt;but it doesn&amp;#8217;t take into account the numbering in StyleDefinitionsPart&lt;br /&gt;&amp;#125;&lt;br /&gt;Comments: ** Comment from web user: HomerSimpian ** &lt;p&gt; I'm seeing the same issue as dadawley before wrote.  The loss of the multilevel numbering is crucial when applied to heading styles!  I don't know if I have time to look closely at this, but this is very much a setback for my use. &lt;/p&gt;</description><author>HomerSimpian</author><pubDate>Sat, 23 Feb 2013 21:21:49 GMT</pubDate><guid isPermaLink="false">Commented Issue: Style numbering disappear after merge [10590] 20130223092149P</guid></item><item><title>Commented Issue: DocumentBuilder doesn't work properly with Bookmarks at the end [10762]</title><link>http://powertools.codeplex.com/workitem/10762</link><description>If you concatenate 2 files with the DocumentBuilder and the first document has a &amp;#96;w&amp;#58;bookmarStart&amp;#96; and &amp;#96;w&amp;#58;bookmarkEnd&amp;#96; tag between the final paragraph and the document end &amp;#96;w&amp;#58;sectPr&amp;#96;, the resulting document won&amp;#39;t be correct. The first paragraph of the the second document will be part of the first document. The markup then looks like this&amp;#58;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;w&amp;#58;p&lt;br /&gt;whatever the content&lt;br /&gt;w&amp;#58;p&amp;#47;&lt;br /&gt;w&amp;#58;bookmarkStart&amp;#47;&lt;br /&gt;w&amp;#58;bookmarkEnd&lt;br /&gt;  w&amp;#58;pPr&lt;br /&gt;    w&amp;#58;sectPr&amp;#47;&lt;br /&gt;  w&amp;#58;pPr&amp;#47;&lt;br /&gt;w&amp;#58;bookmarkEnd&amp;#47;&lt;br /&gt;&amp;#96;&amp;#96;&amp;#96;&lt;br /&gt;It seems that the document end &amp;#96;w&amp;#58;sectPr&amp;#96; is added &amp;#40;along with an additional &amp;#96;w&amp;#58;pPr&amp;#96;&amp;#41; to the tag before it, whatever that tag is. It should be added to the last &amp;#96;w&amp;#58;p&amp;#96; before it.&lt;br /&gt;&lt;br /&gt;Sorry, you&amp;#39;ll have to think the brackets for yourselves. The issue tracker swallowed them along with their content even though they were formatted as code&lt;br /&gt;Comments: ** Comment from web user: EricWhiteDpe ** &lt;p&gt;Hi, I am pretty sure about what the issue is, and that I can fix it.  I'll take a look as soon as I am available to do so.&lt;/p&gt;&lt;p&gt;-Eric&lt;/p&gt;</description><author>EricWhiteDpe</author><pubDate>Mon, 21 Jan 2013 15:33:30 GMT</pubDate><guid isPermaLink="false">Commented Issue: DocumentBuilder doesn't work properly with Bookmarks at the end [10762] 20130121033330P</guid></item></channel></rss>