• Creator
  • #2226500

    Printing Rich Text Box data in word through VB


    by vsasikala ·


    I have a code to change the font style of Rich text box during runtime. Now i want to print the same data in MSWord. (I don’t want to store the data) When i am trying to print the data i am getting only datas without its different kind of styles.

    Could anybody help me to write the code.


All Answers

  • Author
    • #2636450


      by vsasikala ·

      In reply to Printing Rich Text Box data in word through VB


    • #2636494

      You need to learn the RTF language

      by pathak.abhishek ·

      In reply to Printing Rich Text Box data in word through VB

      See, rtf documents are very similar to html documents in principal(they both work using ‘tags’).If you need to print data to rtf documents then you should learn these tags,i.e. the RTF language. In my opinion the best place for code and theory for VB is Mastering VB 6 , written by Evangelos Pertroutso. Otherwise, if you are not mad about using rtf ONLY, then I suggest that you go for OLE of OLE Automation(better,easier) and use a .doc format to show data by ‘Automating MS word’. The method is simple:
      1.Add a reference to MS word using reference from menu in VB.
      2.Create a withevents object of words.doucments type.
      3.Then using the methods and data exposed by this object(it will show up automatically by autocomplete), you can not only show data, but do things far-far-far greater than that.
      4.Hope you know that you will also have to create an OLE object by either ‘linking’ or ’embedding’ if you use OLE(not OLE Automation).
      5.I suggest an even better method, that is to look for some ActiveX plugins which could handle your task automatically.
      In case of further doubts , I think that Mastering VB 6 book should be able to solve your problem.

Viewing 1 reply thread