Beginner needs a little direction.

Home Forums WordprocessingML Beginner needs a little direction.

This topic contains 3 replies, has 2 voices, and was last updated by  Eric White 7 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3557

    Scott
    Participant

    Hi, my name is Scott an I am very new at this open xml stuff.

    I believe the answers are somewhere here within site, but I would like to pointed to the correct screencast, blog entry, forum topic, or outside resource that will help me with my project.

    I am running Visual Studio Professional 15 update 3. I also have access to MSDN & GitHub.

    Project Description:

    I will be receiving basic MS Word docx files from my clients. I will then highlight certain text within those documents and create tagged content controls (mostly plain text but could be RTF format as well). to create templates.

    My software will gather data on the web (probably with web forms) for each customer job entered and store it in a database. when the customer is ready the software will pull the appropriate data from the database to populate the template created above and save it as a new docx file.

    Any help, clues, etc would be appreciated.

    Thanks,

    Scott

    • This topic was modified 7 years, 10 months ago by  Scott.
    #3692

    Eric White
    Keymaster

    Hi Scott,

    Very sorry for the slow response – I was on vacation and traveling. I’m back in the saddle again.

    Your scenario is very doable using Open XML.

    Take a look at the screen-casts for DocumentAssembler:

    http://www.ericwhite.com/blog/blog/documentassembler-developer-center/

    The approach is that you generate the appropriate XML from your data source, have a template that refers to your newly generated XML, and then you generate your desired document by invoking a single method.

    I also recommend watching the screen-cast series on Open XML and WordprocessingML – links in the side bar.

    Cheers, Eric

    #3743

    Scott
    Participant

    Eric,

    Thanks so much for your reply.

    I have gone down the DocumentAssembler direction per your suggestion and am having some success.

    I am however having a bit of difficulty with repeating content:

    I am getting a error “Repeat: Select returned no data” on the code:

    <Repeat Select=”./Parties/Role/Plaintiffs/Names”/>
    <Content Select=”./Name”/>,
    <EndRepeat/>

    But very similar code in the same document works fine:

    <Repeat Select=”./Attorneys/Attorney”/>
    <Content Select=”./Name”/>, Atty Reg #: <Content Select=”./RegNum”/>
    <EndRepeat/>

    My XML Data is as follows:

    <?xml version=”1.0″ encoding=”utf-8″?>
    <!– edited with XMLSpy v2016 rel. 2 sp1 (x64) (http://www.altova.com) by Scott Snodgrass (Relentless Pursuit, LLC) –>
    <Affidavit>
    <CourtName>DISTRICT COURT, DENVER COUNTY, COLORADO</CourtName>
    <CourtStreet>1437 Bannock Street</CourtStreet>
    <CourtCity>Denver</CourtCity>
    <CourtState>CO</CourtState>
    <CourtZip>80202</CourtZip>
    <Party1Title>Plaintiff</Party1Title>
    <Party2Title>Defendant</Party2Title>
    <Plaintiff>John Q Public</Plaintiff>
    <Defendant>Son T Do</Defendant>
    <Parties>
    <Role>
    <Plaintiffs>
    <Names>
    <Name>John Q Public</Name>
    </Names>
    <Names>
    <Name>Suzy Public</Name>
    </Names>
    </Plaintiffs>
    <Defendants>
    <Names>
    <Name>Son T Do</Name>
    </Names>
    </Defendants>
    </Role>
    </Parties>
    <CaseNum/>
    <AttorneyFor>Plaintiff</AttorneyFor>
    <LawFirm>Gaiennie Law Offices, LLC</LawFirm>
    <LawFirmStreet>3801 E Florida Ave., Suite 100</LawFirmStreet>
    <LawFirmCity>Denver</LawFirmCity>
    <LawFirmState>CO</LawFirmState>
    <LawFirmZip>80210</LawFirmZip>
    <LawFirmPhone>303 455-5030</LawFirmPhone>
    <Attorneys>
    <Attorney>
    <Name>Meredith A Quinlivan</Name>
    <RegNum>38016</RegNum>
    </Attorney>
    <Attorney>
    <Name>Gorgy Alhasoon</Name>
    <RegNum>47505</RegNum>
    </Attorney>
    <Attorney>
    <Name>Robert R. Harper</Name>
    <RegNum>48454</RegNum>
    </Attorney>
    <Attorney>
    <Name>Amy E Gaiennie</Name>
    <RegNum>24561</RegNum>
    </Attorney>
    </Attorneys>
    <Server>Scott Snodgrass</Server>
    <ServerCompany>Relentless Pursuit, LLC</ServerCompany>
    <ServerStreet>3531 S. Logan St. D-411</ServerStreet>
    <ServerCity>Englewood</ServerCity>
    <ServerState>CO</ServerState>
    <ServerZip>80113</ServerZip>
    <ServerPhone>(303) 570-6285</ServerPhone>
    <ServiceDate>August 20, 2016</ServiceDate>
    <ServiceTime>1:55 PM</ServiceTime>
    <ServiceCompany/>
    <ServiceStreet>9033 E Louisiana Ave</ServiceStreet>
    <ServiceCity>Denver</ServiceCity>
    <ServiceState>CO</ServiceState>
    <ServiceZip>80247</ServiceZip>
    <ServiceCounty>Arapahoe</ServiceCounty>
    <ServiceDocuments>
    <Document>
    <DocName>Summons</DocName>
    </Document>
    <Document>
    <DocName>Complaint</DocName>
    </Document>
    <Document>
    <DocName>Civil Cover Sheet</DocName>
    </Document>
    </ServiceDocuments>
    </Affidavit>

    Any ideas on what is wrong?

    #3793

    Eric White
    Keymaster

    Hi,

    Did you get this resolved?

    Nothing stands out for me – looks correct.

    What I would do in this situation – find the code in DocumentAssembler.cs that evaluates the XPath expression – at that point, you can see the XML that it is querying, you can see the XPath expression, and the results of the query.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.