Solved

RichTextBox loading Word created RTF files

Posted on 2001-07-18
17
1,129 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

773 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