Link to home
Start Free TrialLog in
Avatar of vblogic
vblogic

asked on

RichTextBox loading Word created RTF files

As the title implies, what are some considerations here?  For example, I created a template in Word to use for generating a report.  I saved it as an *.rtf file.  The template contains a header/footer and a graphic.  When I load it into the VB richtextbox control, nothing appears.  Why is that?  If this isnt a possible solution, what are my alternatives?  Thanks in advance.
Avatar of Dave_Greene
Dave_Greene

Load it like so...

RTB.LoadFile file.rtf, rtfRTF
Avatar of vblogic

ASKER

I have done that.  If I then view the TextRTF property of the control, its showing the correct RTF codes (the same as if I opened the RTF file in a plain text editor).  However, the control does not show either the image, or the header/footer, as can be seen from viewing the same RTF file in Word.
Not sure if this is a limitation of the VB control or not...  
Must be a limitation.

Just place the image outside the header region in word and it will display.
ASKER CERTIFIED SOLUTION
Avatar of Dave_Greene
Dave_Greene

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm not sure what your options are,
but you're using 2 different file types here.
A rich text box supports rtf files and a
word template (dot file) is not an rtf file.
Avatar of vblogic

ASKER

I saved the Word template file (*.dot) as an rtf file, and it is THAT rtf file which does not show in the VB richtextbox.
Avatar of vblogic

ASKER

I ended up having to build specific rtf codes manually to create the effects I needed.  The VB richtextbox needs to get its butt in gear IMHO.
True, True

:)
I tried doing what you said using Word97,
but after creating the *.dot file,
Word disabled the File Type box so
I couldn't resave the *.dot as a *.rtf.

I could save the original *.doc as an
*.rtf and I loaded that into the RichTextBox.
The graphic appeared but the header didn't.
I opened WordPad and I didn't see anywhere
that it could handle Headers.
Does that help?
Avatar of vblogic

ASKER

well, in Word2000 i was able to save the *.dot as a *.rtf file.  however, the headers, and logo included in the header, did not show on the richtextbox control.  i ended up doing it manually via code, and manually entering specific rtf codes to adjust margins and other things that were originally stored in the template file (all of which did not show up in the richtextbox control).

thanks for your time guys, but i ended up having to just do this one myself.
Just as I posted earlier

Comment
From: Dave_Greene  Date: 07/18/2001 08:13AM PST  
You will just need to minimize the header and footer region and place the items in at the top and bottom
manually.

Cheers  
Avatar of vblogic

ASKER

Just as you posted earlier

Comment
From: Dave_Greene  Date: 07/18/2001 08:02AM PST  
Not sure if this is a limitation of the VB control or not...


which was my original question.  Apparently, you didnt know either, and you went and loaded a sample to see the same thing I saw.  The obvious thing to consider after finding out the VB richtextbox is lame is to DIY.  Your last comment seems to imply that you knew something I didnt know.  If you want my points that bad, I'll give them to you, but please dont pretend to have offered anything of any real value here.
No, I could care less about the points...  The issue is that I told you it couldn't be done that way before you found out for yourself.  So essentially I did answer your question.  The unfortunate outcome however was that it couldn't be done with VB's RTB.

Suppose I posted the answer, and you found the answer yourself sometime later, would the same situation apply?  
Avatar of vblogic

ASKER

>>The issue is that I told you it couldn't be done that way before you found out for yourself.  

This is a complete contradiction of what happened here.  From the beginning, you assumed it would work, and then explained that you werent sure.  You told me what I already knew.  In essence, I knew it before you did...that the VB richtextbox did not support headers/footers.  How did I found out?  I loaded an rtf file with headers into the VB richtextbox and nothing showed up.   How did you find out?  You loaded an rtf file with headers into the VB richtextbox and nothing showed up.  I hardly think that constitutes finding the answer before I did.  

I already knew, and I think most people do, that you can add pictures to the VB richtextbox.  Telling me to do that was nothing extraordinary, it was just a last resort if there was no better alternative.  I thought perhaps Word supported headers with certain rtf codes not supported by the VB richtextbox, but that the VB richtextbox did support other rtf codes that would give a similar effect...like one of the rtf codes listing in the MSDN library.

At any rate, I do thank you for your time.  I dont mean to argue, just please dont try to act as if you have exhibited some great profound knowledge here, and that I should in some way be in awe of it.  I dont believe the "experts" at this site exist on any level higher than I.  Just because I choose not to spend time answering questions here does not make me any less capable.
VB,

I tried many things behind the scenes and came up with the outcome which I shared with you.  Yes, it wasn't brain surgery, but it did at very least let you know that it wasn't something you were doing wrong.  Which can be as valuable as source code out of thin air.  You're welcome for my time spent on this thread, and no I do not think I am better than you in any way.  Just trying to help, that is all.

-Dave
Avatar of vblogic

ASKER

Thanks Dave...been one of those days for me.  I apologize for coming off so hostile.  See ya on the boards...