The Hell of RichTextBox

nice_guy_in_stj
10-25-2004, 11:25 AM
Here's the problem : My boss wants me to create a file for a lab order. This lab order should be small enough to fit on a piece of paper 5" by 8". Now for the annoying part; some clients don't have Word installed so the file must be a Rich Text Format file. Furthermore there must be a black rectangle surrounding the lab order.
I'm using a RichTextBox control to read in a rtf file I created in word. The file has a bunch of variables, and when it comes to creating the lab order I simply do a 'search/replace' of the variables with the propper values. For some reason I can see the line shapes that surround the lab order when viewing it in Word, but not when viewing it in the RichTextBox. Consequently, when I go to rtb.SaveFile "NewLabOrder.rtf", the new lab order file does not have the square border anymore.
I opened the rtf file in Notepad to discover the {\shp} tag which is what creates the lines. I can't seem to get the RichTextBox to reconize that the {\shp} tag means it should draw a line.
My question is why does the RichTextBox controle not pick up on the {\shp} tag, and how else could I create a border around the labOrder ?

couch612
10-25-2004, 07:51 PM
how about trying to do it in HTML format? This might be more universally readable.

webbone
10-25-2004, 11:00 PM
This isn't a solution, but a check of the supported tags list for the RTB control reveals that the shp tag is NOT supported (sorry to say). The complete list is here on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rtfbox98/html/vbconsupportedrtfcodes.asp

You might want to look at the RichEdit control (http://www.vbaccelerator.com/codelib/richedit/richedit.htm) at vbaccelerator - I'm not sure if it supports that tag but I know it gets great reviews from some of the users around the forum here.

nice_guy_in_stj
10-27-2004, 05:05 AM
Ah well, maybe the clients won't mind printing off a few dozen sheets with just the border around it first... thanks for the link to vbAccelerator, it can't help me with the border, but I could certainly find a use for it in a different section of the program.

anon
10-27-2004, 05:39 PM
..and how else could I create a border around the labOrder ?
Have you looked at the Line method of the Printer object (Printer.Line)?
Using the "B" parameter will draw a box instead of a line.

Here's a little tutorial:
http://216.239.57.104/search?q=cache:ePWy4JaBCIMJ:www.developerfusion.com/scripts/print.aspx%3Fid%3D86+vb+Printer.Line&hl=en

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum