Welcome to MSDN Blogs Sign in | Join | Help

Why I love the new file format in Office 12

You may have read about the new file format in Office 12.  It is based on a zip file that contains separate XML ‘parts’.  When I first saw this I nearly fell of my chair.  Let me explain.

A few years ago while working in MCS in New England I worked on a gig for an insurance ISV in Connecticut.  The application I was building basically had to print letters to remind policy holders to renew their Professional Liability insurance.  Well this was in 1998 and the only really safe way to do this was to automate Word.  This of course meant that you could not run the app on the server – Oh NO!  Automating Word on the server is a definite no-no.  As soon as a dialog box pops up your app is toast.  So the app was run by hand by an employee as the last job in the afternoon before going home.  In the morning there would be a bundle of Word docs ready to print. 

What a hack!

I thought about opening the binary and doing a grep of strings in the binary.  Fortunately I asked a colleague to slap me hard before I went  ahead and did that.  Then I looked at using bookmarks and the rest but that was  too slow and complicated.  So instead I put placeholder text throughout the template files.  These were strings like xyzzyName, xyzzyAddress and so forth.  Then I automated Winword to replace strings with elements I had in a data set. 

I told you it was a hack.

The process took several hours taking a minute or two per  document.  Well now I can imagine doing this in Office12.

·        First I would use a custom XML binding  in the zip file of the docx.

·        Then I would look open the zip using winfx

·        Next stream in the row of a dataset into the customXML folder in the zip.

·        And… well that’s it really. Just close the stream and you have a word document. If you feel like it you could do this on Linux.

 

I really can’t justify the time to try this out now -  you can’t forever have ‘do-overs’of the messy things you have done in your life.  Still I expect that it would take about 100ms to perform this job per document on a fast box. And it can be done on the server. Think about it real server side processing of Word documents!

Published Monday, February 13, 2006 12:53 PM by davewebster
Filed under:

Comments

No Comments
New Comments to this post are disabled
 
Page view tracker