Welcome to the new EricWhite.com

Hi friends,

With the recent decision to shutter OpenXmlDeveloper.org, I will be focusing my efforts to support Open XML developers here at EricWhite.com.

Forums: I have set up forums on this web site, so that we have a convenient place to discuss Open XML specific questions.  I have set up forum categories based on my experience with OpenXmlDeveloper.org – there are fewer categories, which should make it easier to pick the appropriate forum for your questions. Feel free to suggest new forum categories. Forums link are in the sidebar. You will need to have an account here to post in the forums. Please feel free to create one. At the top of each forum, you can subscribe, which will send email notifying you of activity.

Content: I have moved much of the content from OpenXmlDeveloper.org to this web site. Over the next month or two, I’ll be moving the rest of the interesting content here.  In the process of moving this content over, I’ll be reviewing and updating it, making sure that it recommends current best practices for Open XML development.  In addition to moving the content over, I have created ‘Developer Centers’ around specific topics such as Open-Xml-PowerTools, DocumentAssembler, DocumentBuilder, PresentationBuilder, WmlToHtmlConverter, and HtmlToWmlConverter.

Blogging: I will be regularly blogging about my Open XML activities here.

Twitter: Follow me (@EricWhiteDev) on twitter to get the latest news about Open XML development and tools.

LinkedIn: Connect, especially if you are an Open XML developer.

I will continue to enhance and support Open-Xml-PowerTools – it is a ‘live project’, with interesting enhancements planned for the near future.  I consider that Open-Xml-PowerTools is perhaps 25% complete – there is an awful lot that we can do to make server-side Open XML document generation and processing easier.  My plans are firming up for the next round of enhancements – stay tuned – I’ll keep you posted.

We have done nowhere near enough with the Open-Xml-Sdk-for-JavaScript.  There are great advantages to processing Open XML with JavaScript – cross-platform – process in browser – process with NodeJs.  And should take advantage of TypeScript, I think.

I love document formats.  I love the capacity to create and process rich content that we have gained due to the standardization of the Open XML format.  We have made great progress over the years, and I am looking forward to continuing to advance the state-of-the-art of document generation and processing.

As an aside, one thing that I am going to enjoy a lot is moving off of the old version of Telligent Community Server that we were using for OpenXmlDeveloper.org – what a pain.  EricWhite.com is a WordPress site, updated to the latest version. It is a pleasure to move into a modern, blogging / content management platform.  The forums here are implemented using bbPress, which gives us a flexible, easy to use platform.

Cheers, Eric

!!!

25 Comments »

  1. ron said,

    March 4, 2016 @ 8:36 am

    Good luck with the new site Eric.

  2. Eric White said,

    March 12, 2016 @ 1:54 am

    Thanks Ron, should be fun.

  3. mike said,

    March 4, 2016 @ 4:52 pm

    Hi Eric,

    Does OpenXmlPowerTools require WindowsManagementFramework to be installed as a prerequisite? I am getting a requirement for windows.management.infrastructure to be installed in the GAC when I include OpenXmlPowerTools in a clickonce installation.

    Thanks,

    Mike

  4. Eric White said,

    March 12, 2016 @ 1:52 am

    Hi Mike,

    What version are you using?

    There are some modules that are there only for the purposes of enabling integration with PowerShell. If you do not require enabling CmdLets to work, you can eliminate those modules without affecting the others. You can search for namespace. Or alternatively, if you are using only C# code, you can include just the files you need, which is better. Include the module you require, build, add modules that contained referenced types, and repeat. Only requires a couple of iterations.

    Cheers, Eric

  5. Email Spike OTO said,

    March 25, 2016 @ 7:42 am

    Regardless of the occasion, a catastrophe declaration begins the formal means of Business Continuity Plan.

  6. A Razak Subahan said,

    May 6, 2016 @ 9:06 pm

    Dear sir,

    I write my app in asp.net using vb. I tried you display DOCX file using xml…All is ok except that the to title area give me error says “BC30456: ‘CoreFilePropertiesPartDescendants’ is not a member of ‘DocumentFormat.OpenXml.Packaging.WordprocessingDocument’.

    Source Error:

    The SOurce Code
    Public Shared Sub ConvertToHtml(ByVal byteArray() As Byte, ByVal destDirectory As DirectoryInfo, ByVal htmlFileName As String)
    Dim fiHtml As New FileInfo(Path.Combine(destDirectory.FullName, htmlFileName))
    Using memoryStream As New MemoryStream()
    memoryStream.Write(byteArray, 0, byteArray.Length)
    Using wDoc As WordprocessingDocument = WordprocessingDocument.Open(memoryStream, True)
    Dim imageDirectoryFullName = fiHtml.FullName.Substring(0, fiHtml.FullName.Length – fiHtml.Extension.Length) & “_files”
    Dim imageDirectoryRelativeName = fiHtml.Name.Substring(0, fiHtml.Name.Length – fiHtml.Extension.Length) & “_files”
    Dim imageCounter As Integer = 0
    Dim pageTitle As String = CStr(wDoc.CoreFilePropertiesPartDescendants(DC.title).FirstOrDefault())

    Dim settings As New HtmlConverterSettings() With {.PageTitle = pageTitle, .FabricateCssClasses = True,
    .CssClassPrefix = “pt-“,
    .RestrictToSupportedLanguages = False,
    .RestrictToSupportedNumberingFormats = False,
    .ImageHandler = Function(imageInfo)

    Dim localDirInfo As DirectoryInfo = New DirectoryInfo(imageDirectoryFullName)
    If Not localDirInfo.Exists Then
    localDirInfo.Create()
    End If
    imageCounter += 1
    Dim extension As String = imageInfo.ContentType.Split(“/”c)(1).ToLower()
    Dim imageFormat As ImageFormat = Nothing
    If extension = “png” Then
    extension = “gif”
    imageFormat = imageFormat.Gif
    ElseIf extension = “gif” Then
    imageFormat = imageFormat.Gif
    ElseIf extension = “bmp” Then
    imageFormat = imageFormat.Bmp
    ElseIf extension = “jpeg” Then
    imageFormat = imageFormat.Jpeg
    ElseIf extension = “tiff” Then
    extension = “gif”
    imageFormat = imageFormat.Gif
    ElseIf extension = “x-wmf” Then
    extension = “wmf”
    imageFormat = imageFormat.Wmf
    End If
    ‘If Not imageFormat Then
    ‘ Return “”
    ‘ End If
    Dim imageFileName As FileInfo = New FileInfo(imageDirectoryFullName & “/image” & imageCounter.ToString() & “.” & extension)
    Try
    imageInfo.Bitmap.Save(imageFileName.FullName, imageFormat)
    Catch e1 As System.Runtime.InteropServices.ExternalException
    ‘ Return nothng
    End Try
    Dim img As XElement = New XElement(Xhtml.img, New XAttribute(NoNamespace.src, imageDirectoryRelativeName & “/” & imageFileName.Name), imageInfo.ImgStyleAttribute, If(imageInfo.AltText Nothing, New XAttribute(NoNamespace.alt, imageInfo.AltText), Nothing))
    ‘Dim img As [Return]
    End Function}
    Dim html As XElement = HtmlConverter.ConvertToHtml(wDoc, Settings)

    ‘ Note: the xhtml returned by ConvertToHtmlTransform contains objects of type
    ‘ XEntity. PtOpenXmlUtil.cs define the XEntity class. See
    http://blogs.msdn.com/ericwhite/archive/2010/01/21/writing-entity-references-using-linq-to-xml.aspx
    ‘ for detailed explanation.

    ‘ If you further transform the XML tree returned by ConvertToHtmlTransform, you
    ‘ must do it correctly, or entities will not be serialized properly.

    Dim body = html.Descendants(Xhtml.body).First()
    body.AddFirst(New XElement(Xhtml.p, New XElement(Xhtml.a, New XAttribute(“href”, “/textxml.aspx”), “Go back to Upload Page”)))

    Dim htmlString = html.ToString(SaveOptions.DisableFormatting)

    File.WriteAllText(fiHtml.FullName, htmlString, Encoding.UTF8)
    End Using
    End Using
    End Sub

  7. A Razak Subahan said,

    May 8, 2016 @ 10:37 am

    thant you for your advise . I also have problem becauase when image jpeg will show when display but file stored image and xml show the link…Please advise thanls

  8. Pablo said,

    May 28, 2016 @ 4:12 pm

    Are there plans for WmlToHtmlConverter equivalent for PPTX?
    Are there other ways to convert PPTX to HTML or SVG?

    Thanks

  9. Rohit said,

    September 29, 2016 @ 4:26 am

    I am creating one slide PowerPoint file using open XML. I have tagged the placeholder in the PPT which i need to update programatically. I am able to find the placeholder and can update its value from the database.

    Now the problem is I need to display some HTML code which user has input using WYSIWYG editor in a same format as user has entered e.g. like in bullets.

    When i try to replace the place holder with the HTML text, the HTML text was pasted as is like all the tags etc.

    Below line is working fine when i need to paste simple plane text

    List textList = tableSlidePart.Slide.Descendants().Where(t => t.Text.Equals(“IntroText”)).ToList();
    foreach (DocumentFormat.OpenXml.Drawing.Text text in textList)
    {
    text.Text = “Some Text”;
    }

    But when i wanted to paste HTML into the placeholder it is treated as normal plain string.

    textList = null;
    textList = tableSlidePart.Slide.Descendants().Where(t => t.Text.Equals(“##DESCRIPTION##”)).ToList();
    foreach (DocumentFormat.OpenXml.Drawing.Text text in textList)
    text.Text = “Hello“;

    Any help or pointer would be appreciated. Thank you in advance.

  10. Eric White said,

    October 7, 2016 @ 4:27 pm

    Hi Rohit,

    There is no good way to import HTML into a PowerPoint slide, AFAIK.

    I have long contemplated writing an HtmlToPmlConverter module, similar to HtmlToWmlConverter. I already have much of the hard work done, i.e. a CSS parser, dom tree that applies the CSS, and so on. But this is a large project, and not on my radar right now.

    Sorry I don’t have a better answer for you, but right now I do not.

    Also, if you would be good enough to post on the forums on this site, would be more convenient. Also, you might get a response sooner – as I regularly check forums, but check for comments less often.

    Best, Eric

  11. Manognya said,

    December 6, 2016 @ 8:54 am

    I am using open xml to replace image in word header. But while all the operations are done and if i am opening the doc again then it is showing some error in the document.xml file.

    Please help me out.

    Thanks

  12. Arnold Curry said,

    December 16, 2016 @ 2:55 pm

    Hello Eric,

    I was wondering why I don’t see much effort in converting Microsoft PowerPoint presentations to HTML while I do see several Office Word documents to HTML. PowerTools manipulates .pptx files but doesn’t go the extra mile and convert to HTML. Do you plan on working on such an effort.

    Thank for your input,
    Arnold

  13. Eric White said,

    December 16, 2016 @ 4:08 pm

    @Arnold Curry, this is something that I’ve considered – it hasn’t yet risen to the top of the heap. I believe that with regards to document format processing and Open XML processing, we have realized only 20% of the benefit. There is so much more to do!

  14. sagar said,

    January 10, 2017 @ 7:12 pm

    Hi ,

    There are table tags in my html. When I tried to convert it into Word Doc using the library HtmlToWmlConverter , tables are not getting showed in word doc.

    Following is example of html file which I’m converting into Word Document.

    Col1
    Col2
    Col3

    Sa
    ab
    da

  15. Eric White said,

    January 10, 2017 @ 10:51 pm

    @sagar, are you certain that it is not a table that has no borders in Word? It very well may be creating a table, but there are no borders, so it doesn’t appear that there is a table. If you click on text in the table, the little + will show at the upper left of the table, and in this fashion, you can determine that a table was inserted.

    The HtmlToWmlConverter attempts to honor all borders, and as such, if the html table has no borders, the word table will not either.

    Best, Eric

  16. Rambabu said,

    February 1, 2017 @ 7:35 am

    Hi Eric,

    How to add the comments in excel spreadsheet for a particular word using openxml c#. Can you please suggest me how to do that?

    Thanks,
    Rambabu

  17. Hotmail said,

    May 5, 2018 @ 9:45 am

    Good job bro. I will miss that website.

  18. AlizaMiller said,

    June 26, 2018 @ 11:23 am

    Nice initiative after shut down of openxml

  19. liuyi said,

    May 29, 2019 @ 10:11 am

    Hi Eric:
    I am a OpenXML user,I have some questions in creating a word doc using openXML,I try to create a table of contents in the doc file,but pages do not exist.Moreover,I want to create the table of contents after the cover but failed,the table of contents are created before the cover.Can you help me?
    Thanks,
    Liuyi

  20. Willie said,

    May 30, 2019 @ 9:45 am

    Hi Eric
    Could you do me a favor to teach me how to export a datatable data to the word template form, thanks.

  21. papita awale said,

    August 20, 2019 @ 12:08 pm

    Hi Eric,
    I am using open xml to read custom properties of file, it reads custom properties successfully when file is simple one,

    but if file is password protected then open xml is not able to read file’s custom properties , what is the latest version of open xml and does it support password protected files now?

  22. angeline wijaya said,

    September 4, 2019 @ 3:15 pm

    hi eric…
    welldone for this new site … good luck eric for you new blog..

  23. real kissanime said,

    October 5, 2019 @ 10:30 am

    hello Eric,
    This is an interesting article that shows how you can take advantage of the C# code that sits behind the PowerTools for Open XML. He recreates in C# the PowerShell application that Lawrence Hodson wrote for this article. The primary purpose of the PowerTools for Open XML isn’t to provide a C# library for developers to use. when i apply it i feel Its main purpose is to provide example code and guidance for the types of things you commonly want to do with Open XML. That said, this is an interesting article that shows how to look around inside the PowerTools source code, and to use the DocumentBuilder class (from C#) to generate a nicely formatted word processing document.

  24. jeniffer said,

    October 5, 2019 @ 1:57 pm

    I think I got did the git files correctly, but when I run any of the OpenXML SDK or PowerTools solutions I get the Trueclassics error, OpenXmlPowerToolsDocument

    I also did a search and found very little info on that term above. I am using the VS 2015 Community Edition. I also don’t see the Test Explorer. Is that only with the Ultimate version of VS 2015?

  25. Grabby Johan said,

    March 3, 2020 @ 5:12 pm

    I think your articles and content are very good. Thank you for your blog.

RSS feed for comments on this post · TrackBack URI

Leave a Comment