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!

Output Report as *.doc not *.rtf

Status
Not open for further replies.

CautionMP

Programmer
Dec 11, 2001
1,516
0
0
US
Has anyone run across a method to output a report in native Word format and not Rich Text? I have been tasked to figure out a way to do this and I don't want to reinvent the wheel if I don't have to.

Thanks in advance for any input you can provide.
 
I havent seen a OutputTo converter to .DOC

In a way you are stuck with the options that are available.

Are you editing in Word?

If you are not then just Output to Snapshot Format. That will preserve the formatting but you can edit the output.
 
I'm not editing in Word but two of my report fields are embedded OLE objects (Word documents) and I have not found a report control that will resize to accomodate variable length text so I'm planning on building a table in Word and then dump my report data into it.
 
Go for Automation...
I'm not too experienced in Word programming, but it's VBA after all. You just have to find the methods and properties specific to Word. F1 might prove helpful.

Snapshot is good, but if the images are large, it does not work at all.

Good luck

[pipe]
Daniel Vlas
Systems Consultant

 
It's a clunky two step solution but I would suggest encapsulating a function that first saves the report in rtf format and then via automation invoke Word to import the rtf, save it as a doc file, delete the old rtf and voila you are done! Since you can bring up word invisibly so nobody will see these extra steps. There should be plenty of examples of word automation. To get you started with code for invoking Word I found this example by Dashley elsewhere on Tek-Tips.

Ted

--------------------------------
Open an instance of Word within app
thread222-710628

Public wrdapp As Word.Application
Public wrddoc As Word.Document
Public wrdtbl As Word.Table
Public wrdsel As Word.Selection


Private Sub Command1_Click()
Dim wrdtbl As Table

Set wrdapp = CreateObject("word.application")
Set wrddoc = wrdapp.Documents.Add
Set wrdsel = wrdapp.Selection

wrdapp.Documents.Open ("C:\misc.doc")
wrddoc.ActiveWindow.Visible = True
wrdsel.Text = "My word document "
wrddoc.SaveAs ("c:\misc1.doc")

End Sub
Private Sub Command2_Click()
wrdapp.Quit
Set wrdapp = Nothing
Set wrddoc = Nothing
End Sub


Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
wrdapp.Quit
Set wrdapp = Nothing
Set wrddoc = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top