Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preserving Line Spacing in Word

Status
Not open for further replies.

Doug130

Programmer
Mar 27, 2007
3
US
Hi All,

I have a report that I designed for a client that they frequently need to send to Word as an RTF so that can customize some formatting and wording (long legal documents). They would like to change the general format of the report so that lines of text are double-spaced. I can get this effect as an Access report by setting the Line Spacing property of a label or text box to something greater than 0. However, when the report is sent to Word, the line spacing reverts to single-spaced. Does anyone know of away around this? Thanks for any help on this!
 
Here is something you can try. Send a report to Word and set up the formating the way you want. Save the document as a template (.dot) and set the spacing to double (on the menu bar go to Format...Paragraph and look at the spacing options). Then create a procedure to Export the report to the template using the DoCmd.OutPutTo command. The format of the command would be

DoCmd.OutputTo acOutputReport, "Report Name",".rtf" ,"TemplateName.dot"

You will have to save the document later as a .doc file to preserve your template, but it should at least get you close to what you are looking for.

Paul
 
Thanks, Paul. I tried this (I should mention that the client is on Office 2007) and so "created" a .dotx file. Anyway, when I execute the OutputTo command, it opens Word with a blank window. If I try to explicity open the .dotx file Word says it is corrupted.

Doug
 
Doug, can you post the OutputTo command so I can see that. I'm using Office 2003, but I assume that the process wouldn't change much.

Paul
 
Paul,

DoCmd.OutputTo acOutputReport, cReport, acFormatRTF, "c:\LienTracker\test.dotx", True

cReport is a string variable that contains the name of the Access report. This is the same code I have been using, except that I'd output to a file name like test.rtf instead of test.dotx.

Doug
 
The DoCmd looks fine to me. When I created my process, I opened a report, saved it as a .doc file and then saved that as the .dot file with the formatting changes I wanted. I can open the .dot file directly from the folder without any error or issues. I'm guessing it has something to do with the .dotx file you created and not with the process you are using to export the report. Can you try recreating the template and see if that helps?

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top