LAN2LAN Technobabble
Corporate Blogs
I don't know about the other developers out there, but I have often written LotusScript code that uses COM to manipulate Microsoft Office - printing to Word, creating spreadsheets with pivot tables and charts, creating Powerpoint presentations and so on. I actually quite enjoy doing this - particularly spreadsheets as I love manipulating data.

I have an application that I wrote 3 or 4 years ago that manages sales orders and invoices. When the user wants to print the invoice documents they hit a button that outputs the content to Word. I did this because all the things you need, such as programmable headers and footers, pagination, table-based layout that is easy to navigate is sitting there ready for the taking.

This worked beautifully until "Scary Toolbar Word" (i.e. Word 2007 a.k.a "where in the hell did they put feature x that I always knew how to find") started to be deployed across the organisation. My beautiful invoice layout was vertically challenged in that it spread across more pages and the headers and footers became broken as a result. If you produced the invoice in Word 2002 and then opened the resulting document in STW, then it was fine - it was the generation of the document that was the issue.


What I have learned is that in STW, there are some 'helpful' settings that add the following by default to the normal template:

> After paragraph spacing - 10
> Line spacing - 1.15
> Add space between paragraphs of the same style

Now this has the effect under normal circumstances of making a Word document easier to read. However for my invoice layout this proved to be the cause of the problem.

In this particular case I discovered that instead of re-writing my code, one workaround to this is to change the default settings for the paragraph spacing.
  1. On the Home ribbon, in the Paragraph group, click the Paragraph dialog box launcher.
  2. Click the Default… button
  3. Set after paragraph spacing to 0
  4. Set line spacing to 1
  5. If required, select the check box for Don’t add space between paragraphs of the same style.
  6. Click OK.

Once these defaults had been set then my invoice reverted to its former glory!

Comments (0) Melissa Snell August 27th, 2010 15:06:49