Generating A Word 2010 Document based on XML File RRS feed

  • Question

  • Hello frnds 

    I am having an large XML file generated on servers containing the information like SAN, HOSTNAME,IP's, WWN . . etc.

    My plan is to convert this XML report in to word format i.e, on Word 2010 .docx file. For this I gon through the link and along with the video shown in this link explained in simple way and clear cut information for each stages like   XML->XSLT->HTML->WORD DOCUMENT

    And here they used word 2007 ver to generate the report

    The problem which am facing when going through the same steps .. Is am unable to come with the solution based on my XML file, am getting that word file but without any output when am running the solution file based on source file i.e, XML and XSLT.

    And its a very large XML file it includes nearly 10 servers details in one XML file.
    The example they took in the above link is very simple but mine is its real server report ..
    I gon through in detail to build my document as they done, but am still unable to generate the report ..
    If u go through that video, you will come to know its just a 9min video
    I'll paste some XML code here .. [as I don't know how to attach the file with this post]   
    Please let me know if any one have any idea how to workout with this kind of large XML file ..
    Friends, I really need your suggestions ..

    <SAN:SAN type="Category">
    <SAN:Servers type="Container">
    <SAN:Server type="Category">
    <SAN:HostName type="Property"></SAN:HostName>
    <SAN:HostIPAddress type="Property"></SAN:HostIPAddress>
    <SAN:HostID type="Property">c867d384-48f3-4d5e-8d8e-1dc02febfe06</SAN:HostID>
    <SAN:WWN type="Property">c867d384-48f3-4d5e-8d8e-1dc02febfe06</SAN:WWN>
    <SAN:OSName type="Property">Windows Server 2008 R2 family</SAN:OSName>
    <SAN:IsManuallyRegistered type="Property">false</SAN:IsManuallyRegistered>
    <SAN:IsExpandable type="Property">false</SAN:IsExpandable>
    <SAN:PollType type="Property">4</SAN:PollType>
    <SAN:IfServerSupportSmartPoll type="Property">true</SAN:IfServerSupportSmartPoll>
    <SAN:NumberOfLUNs type="Property">1</SAN:NumberOfLUNs>
    <SAN:IsManaged type="Property">true</SAN:IsManaged>
    <SAN:OSVersionAsString type="Property">6.1 (Build 7601) Service Pack 1.</SAN:OSVersionAsString>
    <SAN:PlatformName type="Property">Windows NT</SAN:PlatformName>
    <SAN:HBAInfo type="Category">
    <SAN:NumberOfHBAPorts type="Property">2</SAN:NumberOfHBAPorts>
    <SAN:HostLoginStatus type="Property">0</SAN:HostLoginStatus>
    <SAN:HostManagementStatus type="Property">2</SAN:HostManagementStatus>
    <SAN:IsAttachedHost type="Property">true</SAN:IsAttachedHost>
    <SAN:LoggedInPorts type="PropertyArray">
    <SAN:LoggedInPort type="Property">3</SAN:LoggedInPort>
    <SAN:LoggedInPort type="Property">0</SAN:LoggedInPort>
    <SAN:LoggedInPort type="Property">2</SAN:LoggedInPort>
    <SAN:LoggedInPort type="Property">1</SAN:LoggedInPort>

    Thank You


    praveen bellary.

    Tuesday, August 6, 2013 10:42 AM


  • The page to which you link outlines a concept of one way XML data can be put into a Word document. No HTML is involved, by the way. Basically, what the approach does is to transform the XML into valid Word Open XML, then append the result an existing Word document, using the Open XML SDK. It demonstrates how to generate the necessary XSL Transform using an automatic tool. Yes, it's a simple example, just to show how it could be done. But such an article is never meant to be used for production, just to show you what's possible. It's probably as close as you're going to get to a "plug-and-use" approach as you'll be able to find for the task you propose...

    That's not the only way to process the XML into a Word file, via the Open XML file format. It's also possible to "walk" the entire XML file, writing the data to the appropriate locations in the document, piece-by-piece. That would probably be a steeper learning curve than working through the article to which you link.

    In the end, it depends on what you feel most comfortable with when working with the XML namespaces. Whether you prefer to spend some time tweaking the XSLT so that it does exactly what you need, or figuring out how to "walk" your XML and leverage the Open XML SDK (or other tool) to work directly with the Word document.

    Note that your first step, in any case, would be to determine how you want the information to be placed in a Word document, and creating the basic "template" for it.

    Please also note that the more appropriate forum for discussing this approach to generating Word documents would be the Open XML SDK forum:

    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, August 6, 2013 4:01 PM