Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Graphics and Rich Text Files

Status
Not open for further replies.

Snipor

Programmer
Feb 23, 2001
92
US
I developed a program for a client that prints out statements for his customer. The statements all all pretty much the same except for the customers information and a few other things. Those things I have to change for each customer. Right now what I have is a program that reads in a pre-made text file, then runs through it adding the customer's data and such to it. I just search for a string, once I find it, I add some text. The problem I'm having is adding a "signature" file to the end. It's a bitmap with a special signature. There are different signatures for each customer. I tried adding the picture directly to the rich text with the LoadPicture command, but it just displays a number. Then I tried using OLEobjects. Performed: rtb1.OLEObjects.Add , , App.Path & "\signature.bmp" This works, buts adds not only the darn graphic, but erases the entire contents of the Rich text box, and adds scrool bars and file options. I just want to load the picture, put on the page where it belongs, and print the darn thing. On top of that, I when I print, the graphic doesn't show. Please, any suggestions would be helpful.

Thanks in advance.
 

You could use crystal reports to accomplish what you want to do but I am not sure that the route you want to take from your message. How are you printing out your text?
 
Unfortunately I don't have working knowledge of Crystal reports. But I think I'm going have to stick to VB. See, this program runs through a a sales text file. Every line of the test file includes the data for a sale, with the customer code, publisher code, merchandise code, and some other stuff. Publisher being the person who made the product, and the customer being the one who purchased it, and merchandise being the merchandise purchased. There are three other text files. One with all the different customers information, one for publisher information (actually that one is a access database), and one for the different types of merchandise. The program has to run through all those text files (and database) and match up the data to the customer, publisher, and merchandise code taking from the sale. then the program prints out a "license" with that information. Then the program goes to the next sale and same thing happens, till all the sales for the day have been gone through. Some of these licenses require a "signature" by the publisher. So we have the signatures saved as bitmaps and just want to tack it on to the end of the license. I'm sending everything directly to the printer. I hope I'm making sense, because I've been working on this and just can't seem to get this working.
 

So if I have this right you are using something like (psudo code)

open file
loop through file looking for things to replace
printer.print textlineoffile
close file

printer.enddoc


If this is so then I belive you could load the "Signature" into a picture box (visable or not) and before you go printer.enddoc you could use

Printer.PaintPicture Picture1.Picture, leftedge, topedge

although you are going to have to calculate the leftedge and topedge plus there are more optional arguments to this as you will see.

Hope this helps
 
I'm not using the Printer object on this one. I'm loading a pre-made text file into a Rich Text box. I marked all the data fields in the pre-made text file with *'s. Code goes something like this: (psuedo code)

Load text file into rich text box
find *
replace * with proper data
next *

then at the end, I print the contents of the rich text box with: rtb1.SelPrint (Printer.hDc)

then clear the contentents of the richt text box and move on to the next sale.

I need a way to replace the * with a picture file. Evertime I use the LoadPicture it puts a number there instead or the picture, except when I'm using the OLEobjects.add activeX component. When I use it though, it erases the entire contents of the Rich text box and replaces it with the graphic, which doesn't even print.

I thought about using the Printer Object. I have used it in the past for creating a paycheck program. But it's tedious work, specially when your printing out a document with several pages of words. If there is a better way to do this, then I'm open to learning better ways to improve myself. So please don't be hesitant to tell me that this way is not good and there's a better way to do it.

Thanks
 

If!, you are only loading and printing plain text then couldn't you loop through the contents of the RichTextBox using the printer object then append the "Signature" at the end.

I know its an ugly solution and I know someone out there could solve this better for you but it is just a thought.
 
I'll see if I can get that to work. I hate doing sloppy code, and this is what it's feeling like. Is there a better way to do this?
 

Another thought that I had is you could create a "Signiture" page. Meaning that you use your current method to print everything else then use the printer object to print the last page and the "Signature".

I know someone out there has a better idea or way to do what you are trying to do so

"Come on people give this person some help".
 
Hey, that's not a bad idea. If nobody speaks up with a better way to do it, then I'm going to do that. Thanks for the idea!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top