General discussion

Locked

Printing in VB 6

By bcollins ·
I have text that I need to print however it is printing off of the righ hand side of the page. Is there any way in VB perform a wrap.

This conversation is currently closed to new comments.

9 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Printing in VB 6

by Lo In reply to Printing in VB 6

Hi - I took a quick look in VB and didn't see any function that might format text where you would pass it a block of text and have it format into N character lines. I would assume there is one there somewhere but ... You can write one yourself if you can't find one. If you are getting data from a text box (or other control) there is a property that will wrap, but I think that only controls display, there may be a way to return it with line breaks, but ... If you are writing multiple lines that have more characters than the printer width, just break it into multiple print statements. As a last thought, there may be a way to set the printer (physically) or the Windows queue to do the wrap for you but ... lo

Collapse -

Printing in VB 6

by bcollins In reply to Printing in VB 6

The question was auto-closed by TechRepublic

Collapse -

Printing in VB 6

by techrepublic In reply to Printing in VB 6

There are many things that you can do with Visual basic's print object, but I suggest you use another method. I used that method is a slow process to hand code every movement on the printer, although possible.

I feel there are 2 better options..
1) You could use the Visual Basic data report designer for database reporting without pictures
2) Probably the best option is Crystal reports or Active Reports. If you own VB 5 it is available as a separate install off the VB 5 installation diskette.
3) Buy Crystal Dev Edition 8 or Active Reports from xtras.com or somewhere.

Crystal gives a number of options to put data from anywhere to a report, including pictures from a database.

I am talking to you from experience. I once createda full page of bar codes and lines and information and got it working well on one printer. The real issues came in when the printer drivers were a bit different.

good luck

Collapse -

Printing in VB 6

by bcollins In reply to Printing in VB 6

The question was auto-closed by TechRepublic

Collapse -

Printing in VB 6

by Mykrotek In reply to Printing in VB 6

Have you looked at using the DrawText API call? This function allows you to define a rectangular area to place the text, and will word wrap the text automatically for you (providing you set the appropriate flags). Check online at Microsoft.com forinfo on using the DrawText API with VB.

Collapse -

Printing in VB 6

by bcollins In reply to Printing in VB 6

The question was auto-closed by TechRepublic

Collapse -

Printing in VB 6

by burtsa In reply to Printing in VB 6

Personally I use a print utility from Pegasus Software, but assuming you want to do it with your own code you will have to write your own wrap function. I would suggest testing the length of the text in pixels using a function like PrinterObj.TextWidth(Str_Var)<PrinterObj.Width.

The TextWidth method uses the font settings and the Str_Var to predetermine what the length of the string would be if printed on one line. You could use this method to check you output and break it up the way you need.

Hope this helps.


Shawn

Collapse -

Printing in VB 6

by bcollins In reply to Printing in VB 6

The question was auto-closed by TechRepublic

Collapse -

Printing in VB 6

by bcollins In reply to Printing in VB 6

This question was auto closed due to inactivity

Back to Web Development Forum
9 total posts (Page 1 of 1)  

Related Discussions

Related Forums