We help IT Professionals succeed at work.

RichTextBox:  Manipulating RTF codes

vblogic
vblogic asked
on
I am using the RichTextBox control to generate reports.  For longer reports, with embedded images, the file can become quite large.  The VB RichTextBox does not provide support for certain RTF codes, such as "\page" to indicate a new page.  I need to be able to generate these page breaks so that the document is correct in structure when viewed in another application that can understand that code, such as Word or WordPad.  Right now, I am using the Replace$ function to replace "flags" I set in the text with the "\page" rtf code.  On files of several megs or more, this is entirely too slow.  Any suggestions?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2012

Commented:
Perhaps you should "upgrade" to VSView.

Anthony

Author

Commented:
1) Do you have experience with this control?
2) How will it help me alleviate my problem?  Its name implies, to me, that it is only for viewing.
3) Does it have built in support for pages (saving *.rtf files with page breaks)?
4) How much code rewrite will be necessary?  Currently I have thousands of lines of .SelText type statements generating my reports. (These reports are not based on data from a database)

It doesnt sound like a substitute to the RichTextBox control which is why I ask what value it can serve here.
CERTIFIED EXPERT
Top Expert 2012

Commented:
I will just give you the link and you can judge for yourself:

http://home.componentone.com/cmd.boa?product=VIEW7
http://home.componentone.com/cmd.boa?product=VIEW7RE

Anthony
CERTIFIED EXPERT
Top Expert 2012

Commented:
Here is another control, that gives you the editting capabilities you are looking for:

http://www.bennet-tec.com/AllText.htm

If you feel that you can achieve your functionality with the RichTextBox than I would keep at it.  I am implying that you are reaching the limit of it's functionality.

Anthony

Author

Commented:
Thanks, however I just found how to work around my problem.  I was setting "flags" in my report so that I could go in later and replace them with the proper rtf code.  For example, I would insert the text "[newpage]" and later go and replace it with "\page" to generate the proper rtf codes.  I had tried doing something along the lines of:

RTB.SelRTF = "\page"

as I built the report, but this always caused an error.  However, if I just do:

RTB.SelText = Chr$(12)

then internally, the correct "\page" rtf code is generated and I dont need to go back and do any replacements.


Thanks for your time.
CERTIFIED EXPERT
Author of the Year 2009

Commented:
Hi vblogic,
You've requested to delete this question, but its status has remained as 'Pending Delete' because one or more comments have been added.  Normally, the only way to fully delete such a Question is to post a message to Community Support and ask for assistance.

EE is making a one-time database sweep to purge the Pending Delete Questions automatically.  During this sweep:

    vblogic -- To allow the deletion to proceed:  Do nothing.
    EXPERTS -- Please DON'T POST a comment except to contest this deletion.

In the future, please refer to http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp#8 for instruction on deleting questions.

DanRollins -- EE database cleanup volunteer
300 points refunded, item moved to our PAQ at Zero points and closed, since Asker included workaround which may help others.
Moondancer - EE Moderator

Explore More ContentExplore courses, solutions, and other research materials related to this topic.