colethecoder
colethecoder

Reputation: 1149

Meaningful XML from MS Word Plugin

I have a requirement to build an MS Word 2007 plugin that provides a button which when clicked uploads the Word document to a webservice as XML.

So far this doesn't seem to be all that problematic but the customer has the additional requirement that they want the XML to be meaningful. They are recording formatted text but want certain areas of the document to be encompassed inside certain tags for example:

<WordDocument>
    <TagArea1>
        *word style xml for this bit of the document here*
    </TagArea1>
    <TagArea2>
        *word style xml for this bit of the document here*
    </TagArea2>
</WordDocument>

Their ideal is to have templates that they can define sections on that when uploaded create this style of XML.

The reason for using Word and not a form based technology is that keeping the formatting consistent is important and being able to choose where page breaks occur etc is vital to them.

I'm concerned that this type of functionality may not be possible but I'm quite new to developing inside Office applications so some pointers would be greatly appreciated.

Upvotes: 0

Views: 480

Answers (2)

JasonPlutext
JasonPlutext

Reputation: 15878

You could try use content controls (sdts) linked to your own XML part. Avoid the i4i patent mess though. See the Gray Knowlton post

Upvotes: 1

user1228
user1228

Reputation:

I'd upload it as a docx (zip file with xml + resources) and manipulate it using System.IO.Packaging. I know that you can do forms in Word, but I'm not sure exactly how that is represented in the docx xml. I'd start by creating a form in Word, use it, save it as a docx, then tear apart the XML to see what's in there.

In other words, I would use the facilities already present rather than try to hack together something.

Upvotes: 2

Related Questions