Discussion:
Print a TStringGrid
(too old to reply)
giordano
2005-01-26 07:55:30 UTC
Permalink
I'm using Borland C++ 6.0 and I have this necessity: is possible to print a
StringGrid ???
Thanks a lot
Silvana
Andrue Cope [TeamB]
2005-01-26 09:30:02 UTC
Permalink
Post by giordano
I'm using Borland C++ 6.0 and I have this necessity: is possible to
print a StringGrid ???
You can print anything you want :)

If you are looking for a function or method that can just send the
contents of the grid to the printer then you are out of luck, I think.
What you'll probably have to do is iterate through all the rows and
columns and send the strings to the printer yourself.

This is complicated by the fact that Windows doesn't provide simple
string printing and more annoyingly nor does the VCL. You have to print
by using TextOut to write the text onto the printer canvas then when
you've filled the canvas you ask the printer to commit it to paper.

There is probably a component or two around that encapsulates this into
a simple function but as long as you are familiar with TextOut(),
GetTextWidth() and GetTextHeight() it isn't too difficult.

TPrinter is the component to study.
--
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Hans Galema
2005-01-26 09:51:59 UTC
Permalink
Post by giordano
I'm using Borland C++ 6.0 and I have this necessity: is possible to print a
StringGrid ???
Of course. But there is no simple statement for it.

But if you manage to put the strings from the rows in the Lines
of a TMemo then Memo1->Print() would do the rest and print
to the default printer.

You could use a TRichEdit also. Then you could format/use
different fonts too. And RichEdit->Print().

Hans.
Michael Philippenko
2005-01-26 12:16:27 UTC
Permalink
Dear Giordano!

Wednesday, January 26, 2005, 10:55:30 AM, you wrote:

g> I'm using Borland C++ 6.0 and I have this necessity: is possible to print a
g> StringGrid ???

FastReport. See demo:
...fastreport\demos\prngrid\
--
Best regards,
Michael Philippenko mailto:***@fast-report.com

Delphi Informant Magazine Readers Choice Awards 2004
Product of the Year and Best Reporting Tool
FastReport http://www.fast-report.com
All results can be found at
http://delphizine.com/newsletterarticle/2004/08/di200408jc_l/di200408jc_l.asp
JD
2005-01-26 14:14:39 UTC
Permalink
Post by Michael Philippenko
Dear Giordano!
g> I'm using Borland C++ 6.0 and I have this necessity: is possible to print a
g> StringGrid ???
...fastreport\demos\prngrid\
<cough>
We're all expecting the *next* release of BCB to have FastReport.

~ JD
Vladimir Stefanovic
2005-01-26 18:02:24 UTC
Permalink
Post by JD
<cough>
We're all expecting the *next* release of BCB to have
FastReport.
Is that really true (that FR with included in next version)?
--
Best regards,
Vladimir Stefanovic
JD
2005-01-26 19:53:19 UTC
Permalink
Post by Vladimir Stefanovic
Post by JD
<cough>
We're all expecting the *next* release of BCB to have
FastReport.
Is that really true (that FR with included in next version)?
It is true that Borland stopped bundling QuickReports and it
is also true that Borland is bundling FastReport with Delphi.
What do you think?

~ JD
Michael Philippenko
2005-01-27 08:51:49 UTC
Permalink
Dear JD!
Post by Michael Philippenko
g> I'm using Borland C++ 6.0 and I have this necessity: is possible to print a
g> StringGrid ???
...fastreport\demos\prngrid\
J> <cough>
J> We're all expecting the *next* release of BCB to have FastReport.

And our FreeReport still free :)
--
Best regards,
Michael Philippenko mailto:***@fast-report.com

Delphi Informant Magazine Readers Choice Awards 2004
Product of the Year and Best Reporting Tool
FastReport http://www.fast-report.com
All results can be found at
http://delphizine.com/newsletterarticle/2004/08/di200408jc_l/di200408jc_l.asp
JD
2005-01-26 14:29:50 UTC
Permalink
Post by giordano
I'm using Borland C++ 6.0 and I have this necessity: is
possible to print a StringGrid ???
A free grid that prints. Comes with source and step by step
instructions on installing.

http://home.tiscali.be/driehoeksw

~ JD
teroni
2005-02-07 06:33:13 UTC
Permalink
I use my own method for printing a string grid as a grid, not just as text. After searching the entire internet for hours, all I could find was how to print a grid as text only. How boring is that? Us programmers don't want to print just text, we want the whole grid. So I came up with my own method that is a little crazy, but works great. I use this method in a program that I have here: http://www.aswsoftware.com/products/movielist/movielist.shtml
sample printouts are here:
http://www.aswsoftware.com/products/movielist/samples.shtml

Basically what I do is have two string grids. They are both manually drawn. One is visible for the user, and the other is invisible. The hidden string grid is the size I want for each page in the print out. I copy the text for the current page from the first grid to the second grid. Then I copy the canvas of the string grid to the canvas of a bitmap and print the bitmap. It's a crazy way to do it, but you have to be resourcefull when no one else on the internet has a clue (atleast that they are willing to share).

I hope this helps.
Anthony S West
Post by giordano
I'm using Borland C++ 6.0 and I have this necessity: is possible to print a
StringGrid ???
Thanks a lot
Silvana
JD
2005-02-07 07:06:08 UTC
Permalink
"teroni" <***@iname.com> wrote:
Please wrap your lines when you post. Your editor (or reader)
may visually wrap them for you but you need to enter a hard
return at the end of each line.
[...] It's a crazy way to do it,
You're right about that.
but you have to be resourcefull when no one else on the
internet has a clue
My post provided a link to a free grid that prints *and*
it includes source code.
(atleast that they are willing to share).
There are several ... if you're willing to look for them.

~ JD
teroni
2005-02-07 07:21:11 UTC
Permalink
Thanks for the note about the line wrap. :)
Post by JD
There are several ... if you're willing to look for them.
(after hours of searching, I found nothing. Don't beat
up my post when I'm only trying to help.)


I use my own method for printing a string grid as a grid, not
just as text. After searching the entire internet for hours,
all I could find was how to print a grid as text only. How
boring is that? Us programmers don't want to print just text,
we want the whole grid. So I came up with my own method that is
a little crazy, but works great. I use this method in a program
that I have here:
http://www.aswsoftware.com/products/movielist/movielist.shtml

sample printouts are here:
http://www.aswsoftware.com/products/movielist/samples.shtml


Basically what I do is have two string grids. They are both
manually drawn. One is visible for the user, and the other is
invisible. The hidden string grid is the size I want for each
page in the print out. I copy the text for the current page
from the first grid to the second grid. Then I copy the canvas
of the string grid to the canvas of a bitmap and print the
bitmap. It's a crazy way to do it, but you have to be
resourcefull when no one else on the internet has a clue
(atleast that they are willing
to share).


teroni
Post by JD
Please wrap your lines when you post. Your editor (or reader)
may visually wrap them for you but you need to enter a hard
return at the end of each line.
[...] It's a crazy way to do it,
You're right about that.
but you have to be resourcefull when no one else on the
internet has a clue
My post provided a link to a free grid that prints *and*
it includes source code.
(atleast that they are willing to share).
There are several ... if you're willing to look for them.
(after hours of searching I found nothing, like
I said above)
Post by JD
~ JD
Loading...