Solved

RichTextBox loading Word created RTF files

Posted on 2001-07-18
17
1,121 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:vblogic
  • 8
  • 7
  • 2
17 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6294580
Load it like so...

RTB.LoadFile file.rtf, rtfRTF
0
 
LVL 1

Author Comment

by:vblogic
ID: 6294608
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.
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6294648
Not sure if this is a limitation of the VB control or not...  
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6294687
Must be a limitation.

Just place the image outside the header region in word and it will display.
0
 
LVL 8

Accepted Solution

by:
Dave_Greene earned 100 total points
ID: 6294693
You will just need to minimize the header and footer region and place the items in at the top and bottom manually.

Cheers
0
 

Expert Comment

by:wmike
ID: 6295426
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.
0
 
LVL 1

Author Comment

by:vblogic
ID: 6302220
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.
0
 
LVL 1

Author Comment

by:vblogic
ID: 6309491
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.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6309497
True, True

:)
0
 

Expert Comment

by:wmike
ID: 6310987
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?
0
 
LVL 1

Author Comment

by:vblogic
ID: 6315023
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.
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6315242
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  
0
 
LVL 1

Author Comment

by:vblogic
ID: 6319822
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.
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6319849
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?  
0
 
LVL 1

Author Comment

by:vblogic
ID: 6319987
>>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.
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6320068
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
0
 
LVL 1

Author Comment

by:vblogic
ID: 6320133
Thanks Dave...been one of those days for me.  I apologize for coming off so hostile.  See ya on the boards...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now