Solved

RichTextBox loading Word created RTF files

Posted on 2001-07-18
17
1,156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month5 days, 21 hours left to enroll

626 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