Home > Archive > VC STL > February 2006 > How to edit and print MS word docs without GUI?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to edit and print MS word docs without GUI?
|
|
| electrixnow 2006-02-11, 7:03 pm |
| I wrote a program in VC++ that generates a text file report. I would
like to get this report data into a word document that my company uses.
I could use bookmarks for reference in the document. Is there some
boiler plate code for C++ or VC++ that I could use to edit and add my
data to the bookmark locations in the MS Word doc file?
After I have updated the MS Word file I need to print it to a network
printer. Is there a easy way of printing this file?
My program is a win32 console application for automation. When it edits
and prints the MS Word documents it has to be done without displaying
the GUI for MS Word.
I am new to all of this windows stuff, any suggestions?
PS. Do you also know a way to email the MS Word document with SMTP?. I
have found a few SMTP add on's but I don't know if this is the best way
and have not installed yet.
Thanks in advance,
Grant
| |
| muchan 2006-02-13, 7:05 pm |
| electrixnow wrote:
> I wrote a program in VC++ that generates a text file report. I would
> like to get this report data into a word document that my company uses.
> I could use bookmarks for reference in the document. Is there some
> boiler plate code for C++ or VC++ that I could use to edit and add my
> data to the bookmark locations in the MS Word doc file?
>
> After I have updated the MS Word file I need to print it to a network
> printer. Is there a easy way of printing this file?
>
> My program is a win32 console application for automation. When it edits
> and prints the MS Word documents it has to be done without displaying
> the GUI for MS Word.
>
> I am new to all of this windows stuff, any suggestions?
>
For using a MS Word document as template and filling replacing something,
IMO it's more C++ friendly to use RTF document as template...
Creating the RTF document (merging the document template and your data)
in C++ code, and call a routin to print this file background.
In one of my project I use a word file with macro to print the document,
but in my case I need some user input so it is not background process.
When Word's security level is set high, it may prompt to ask if user
trusts the document and allowes macro, it was the problem...
Only to play background, maybe Word has command line option /p?
If not, probably you can find another program which can print RTF file
background... If you need to do with .doc format, then I say "good luck!".
:)
> PS. Do you also know a way to email the MS Word document with SMTP?. I
> have found a few SMTP add on's but I don't know if this is the best way
> and have not installed yet.
>
> Thanks in advance,
> Grant
>
You can send any file as attachment... but many people have more experience
about it so I don't speak too much.
muchan
| |
| Simon Trew 2006-02-15, 3:59 am |
| You can do all this with Automation. Searching with e.g. Google for
"Microsoft "Word Automation" gives plenty of useful starting points--
http://gethelp.devx.com/techtips/vf...n/10min0600.asp is one that
seems like a good start, though it is based in Visual FoxPro, it will still
give you the general idea.
You may find it more fruitful to ask futher questions in
microsoft.public.office.developer.automation.
S.
|
|
|
|
|