Export Notes Data To MS Word
Earlier this month I talked about Office XML and promised some examples for the following day. Woops. Better late than never I suppose, here's a demo of using Notes data to create a Word document.
First, create a New Press Release. Fill in the blanks and press the save button. You'll then be in the document in read mode. You should see a Word icon that is a link. Clicking this in non-IE browsers will open a complex-looking XML file. In IE it will probably prompt you like so:
Click open and Word will launch inside IE and show the information you just entered within the new document. Click save and the XML is saved to disk as a file that will open in Word when double-clicked.
Whether or not this works may depend on the version of Office you have installed. I have Office Professional 2003. If you have any other version I'd like to hear if this does/doesn't work and what happens. I think this whole Office XML thing might only work with later versions.
How did I do it? Easy. I took this example file and pasted the contents in to a form called "PressXML", set to use a content-type of "text/xml". I then created a form called "Press", with the fields used to store our data. This form has the Word icon link on it. The link opens the document through a view called "word", whose Form Formula forces it to use the "PressXML" Form. The PressXML Form has been edited so that the fields with our data are in the right places to show the values in the Word document. It doesn't get much easier than that.
I'll do something similar to create Excel files and then I'll polish up the OfficeXML.nsf DB to make it good for download. Not sure if it needs an article though.
More on Office XML.
I tried using IE6, Office XP and when I clicked on the word link it just opened the XML file in IE - no word...?
i guess you must have office 2003.
Yeah, it's starting to look like a 2003 thing. How prevalent is 2003 in the office (note lower-case o) out there me wonders?
This could be very interesting for us. Office 2003 not a problem, but would like it to work either with IE or Firefox. Also would like to able process documents from a view, rather than lauching each document
IE 6 and Word 2000 doesn't work.
Where did you get the example XML file from? Could there be another one for other versions of office/ word?
The example is from the O'Reilly book, which you can download here {Link}
Here's a scenario - I don't have Word but do have Open Office. The xml doesn't open directly from IE, but if I save it and open it with OOo, it looks like this:
{Link}
I assume that's what it should look like since it's an xml standard. Just FYI...thanks!
That looks like a fair attempt at rendering it by OOo. Although it's not perfect. In Word the table was borderless for a start...
What application is opened by the browser, when it receives a certain mime type, can be set within the browser. It is dependent upon what mime type is sent from the link. Different methods for different browsers. Gimme a sec to find links
I tied it with XP pro sp2 + IE 6 + Office 97, Only got the xml.
Only Office 2003, XP and later will recognise the XML (and OOo). From what I've [i]heard[/i], The XP version generates content not recognized by 2003.
I just realized that for Office, are not the browser plug-ins an install option? Maybe some do not have them installed. Anyway, a better way may be to send it to the browser with the same content-type, but add on a content-disposition to the header.
{Link}
* shrug * might work
Man! I'm on Word 97 at work - maybe I'll try this in 10 years or so....
with a mac running Safari 2.0...
clicking the Word icon gave me gibberish in Safari...
I downloaded the linked file to my machine, tried to open in Word X for mac SR1, looked like an XML file...
I opened the .xml file with Apple's Text Edit, voila, looked like a nicely formatted press release!
{Link}
This recent article from the Register claims that only 15% of PCs are runnng Office 2003 - seems to be verified by the results seen in the comments to this article. Like most MS products - they work great in a 100% MS world.
We have been using Jakarta POI {Link} which is a Java API to read/write office files directly. I haven't played with output to Word (yet) but the Excel APIs work a treat. This works for Office97.
Just render your output through Ghost Script and send out pdf files. :-)
{Link}
a friend of mine had this working in Notes 4.6 years ago. Nice as most users have domnloaded the adobe reader plugin for their browser of choice already.
More...
If your interested in making .pdfs, I really recommend considering the use of java and read this.
{Link}
Ghost script takes postscript as input, according to my friend who has played with it. In any case, you're going to produce output for transformation into the target format. The java path will lead you toward XSLT and other exciting things.
The code works although the output on the word document is not formatted the same way I entered it on the web form. I entered the items in bullets and was wrapped around. Is there a way to eliminate this and show the content field the same way its entered on the web form?
Where can i download this example?
Cannot find the download of the officexml.nsf. Is it available?
Thanks
Jens
I never made the database available for download as it's so simple that it didn't seem worth it.
All you need to do is paste the example XML on a form and replace the data parts with fields.
Jake