• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

Edit document from VB 6 without Microsoft Word

Hi all,
I am currently writing a program which essentially reads from and writes to a .mdb database, and then based on some options. Selects the appropriate .doc file and the appropriate record from the .mdb and uses the MS Word control to open the doc in word, find and replace place holder values with the data from the database then print and close the document.
This is all working fine, my problem is that now I'm going to need to install and run this program on systems that dont have Word installed. Is there any way I can do a simmilar thing without needing Word? I'd prefer to keep the documents as .doc but its not essential.
I've already changed th program from using Access to read/write the database to using the Microsoft ActiveX Data Objects 2.0 Library so I wouldn't need Access installed.
Maybe there is something simmilar for Word?

Thanks for any advice.
0
Nemesis09
Asked:
Nemesis09
  • 6
  • 4
1 Solution
 
Mark_FreeSoftwareCommented:

as far as i know it is not possible

you can however convert these documents to rich text,
and open them with a richtextbox
0
 
Nemesis09Author Commented:
Thanks for the idea, but when I tried it the documents are missing parts and are out of allignment when they are opened in a richtextbox, although the .rtf's are fine when opened with word.
Plus, how can I Find/Replace, or other wise insert text in specific areas with specific formatting using this method?
Thanks for any further info.
0
 
Mark_FreeSoftwareCommented:

if you add e secondare textbox on your form, with multiline set to true,
you can use this code to display the formatting:

text1.text = Richtextbox1.rtftext


and then alter the text in text1


to save it back to the richtextbox use this one:

Richtextbox1.rtftext = text1.text

(ofcourse you don't kneed a textbox to replace programmatically, but then you can see the contents of the richtextbox and how it is formatted)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Nemesis09Author Commented:
Why does it display differently in a text box vs a richtext box? And I still have the same problem of inserting the text.
The idea is that the program gets the data (from a combination of textboxes and a .mdb database) then inserts it (now stored each in its own variable) in to the document, prints the document, and closes it without saving.
Thanks for your help so far.
0
 
Mark_FreeSoftwareCommented:

if this is the only things you are going to use that document for, you can paste some special text where you want the data (like #$1$#)

and then you can do a replace$(yourstringhere,"#$1$#",yourdatahere)
0
 
Nemesis09Author Commented:
...hmm now I think were getting somewhere...
So if I open the .rtf in "richtextbox1"
Then use something like;
        " replace$(richtextbox1.rtftext, "RegNo", "ABC-123") "
It will replace "RegNo" with "ABC-123" in the rich textbox... yes?... excelent :)
And as you say, the user never needs to see any of this, just enter some data in several textboxes then have it inserted and printed in a formatted document. The first time they see the actual ".rtf" is the hardcopy on paper.

So just  one more thing... How do I print it?

Thanks for all your help, and sorry for my often slow replies, this is definatley worth more than 125 points... I'll have to fix that :)
0
 
Mark_FreeSoftwareCommented:

you can print trough the "printer" object in vb

this is the default printer.

to test it, i would suggest u download some pdf printer (cute pdf is really good)
and install it as the default printer
that way you can print to pdf files to test the formatting.


the pdf printer will behave exactly the same as a normal printer, except the fact that it gives a dialog to save the pdf,
and it costs no paper.


for more info on the printer object:
http://www.devarticles.com/c/a/Visual-Basic/Printing-With-Visual-Basic/
http://www.andreavb.com/Print.html
0
 
Mark_FreeSoftwareCommented:

think i deserve points with my comment from 05/19/2006 08:01AM CEST

the other comments are "follow-up" comments, to explain some more questions related to this Q
0
 
Nemesis09Author Commented:
I'm sorry I haven't  accepted an answer to this question as yet. I agree that you (Mark_FreeSoftware) deserve the points for your outstanding help on this topic, your assistance has been unbelieveably helpful and your quick responses was greatley appriciated.

The reason I had not "accepted" your answer is that I thought you deserved a lot more points than the question was acctually for, so, the plan was not to accept an answer for a while, let my points build up, then give you an amount indicitive of how much this question got me out of a sticky situation. (say maybe 500 points).

The problem was that other urgent matters came up which demanded my EE points, plus I was out of the country and didn't have access to a pc for a while.

Reguardless, I'll give you all the points I have at the moment. Once again I'm sorry I dont have enough to give you the 500 points you deserve.

Thanks again for all your terrific help.


Ryan.
0
 
Mark_FreeSoftwareCommented:
>>I'll give you all the points I have at the moment.

to know you did that, is showing much better you appreciate it, than someone with enough points giving away 500 points!


mark
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now