472,358 Members | 1,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 software developers and data experts.

Printing a mix of tables and other text

I was wondering if someone could suggest were/how I could get started with
setting up printing of a collection of text that includes tables from a grid
and other supporting information about the grid's contents. If you could
just point me at the classes that I should consider and some very broad
guidelines that would be great. For instances, would a good approach be to
build an rich text document somehow with the proper formatting and then
print that? I would really like to print the grid stuff as tables with lines
marking the grid.

Thanks,

Dennis
Nov 15 '05 #1
7 2363
Actually I'm working on a solution to your exact problem right now. I don't
suppose you're in a situation to be able to make "free" improvements to my
code or work with me on i (keeping the final result completely free for
other's to use)? Anyway, depending on your timeline I can either just send
you what I have right now so you can look it over to get some ideas, etc.
Or if you want to give me a deadline of say 4 days, I can get my *** in gear
and get it posted to my website. I think I just need about 16 quality hours
on it to clean it up to be beta quality. Then another 8 hours or so to
clean up documentation. This is a work-in-progress for over a month (off
and on) and can handle:

printing of datatable's (using classes somewhat akin to the
DataGridColumnStyle class for formatting)
printing of paragraphs of data using style classes (somewhat akin to word's
H1, H2, H3, Normal, etc)
page headers/footers
Hopefully will include graphics/images at some point, too (utilizing the
..NET Image class).
Alternatively, have a look at this (vb.net) article. It was my inspiration
(don't worry, my code is C#):
http://msdn.microsoft.com/library/de...ntwinforms.asp

And other articles of varying quality:
Good intro to the printing namespace
http://msdn.microsoft.com/msdnmag/is...T/default.aspx
simple printing of datagrid
http://msdn.microsoft.com/library/de...ridvisualc.asp
other printing things:
http://www.c-sharpcorner.com/Printing.asp

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
"Dennis C. Drumm" <de*******@primacode.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
I was wondering if someone could suggest were/how I could get started with
setting up printing of a collection of text that includes tables from a grid and other supporting information about the grid's contents. If you could
just point me at the classes that I should consider and some very broad
guidelines that would be great. For instances, would a good approach be to
build an rich text document somehow with the proper formatting and then
print that? I would really like to print the grid stuff as tables with lines marking the grid.

Thanks,

Dennis

Nov 15 '05 #2
"Kieran Benton" <ki****@teejpc.homeip.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Michael,

Sounds like a class act idea! Dont suppose you could let us all know when
u've posted the code? I implemented something a bit like this for a project over a year ago but never made it "production" (lol) quality and there were quite a few limitations to it (Though it did what it needed to at the time).

Actually, I read something that recommended exactly what you did. They said
unless you are REALLY prepared to solve a general problem, don't. Because a
half-baked attempt at solving a general problem with only your specific
problem in mind will only do two things:
1) make your specific solution more complicated than it should be
2) waste time by developing more code than you need
without really ever solving the general problem. (And that a lot of rewrite
will be required to solve the general problem.)

However, I was already 50% towards solving my problem (with a, hopefully,
generic approach) so I ignored the advice. Then I proceeded to rewrite it
all to be more generic. I'm on about the third rewrite and I believe that
will the final major overhaul - I feel it's a farily stable
platform/framework. I'm sure the first person to use my code will find that
it doesn't fit their needs near as well as it fit mine and that might
inspire another major rewrite. ugh!
If possible I might be able to contribute? Building it from a dataset sounds like a damn good design decision, and I never even thought of it!


Sure thing I will post it. I'm tempted to post it under GPL so that all
modifications can further help others. However, I have no problem if people
use the library in a commercial app, I just want any modifications to the
library itself to remain open and free. So I need to read up on licensing a
bit before I post anything. Any comments on licensing schemes that work
well for such a thing?

I only made an hour of progress today, in between other misc tasks. But I
was surprised at how much I got done, despite the fact that I haven't looked
at the code for about a month now.

Here's a quick teaser page (with a teaser app).
http://www.mag37.com/csharp/articles/Printing/

I'll probably update it daily over the next week, so check back often!

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
Nov 15 '05 #3
The first public version of "ReportPrinting" is now released. This is
beta-code. Maybe not even that. It works for me, but I'm curious to see
reactions from others.

http://www.mag37.com/csharp/articles/Printing/

I'll work on getting a simple tutorial up and running. For now, I'd suggest
reading the two links under Documentation, and then looking through the 5
"ReportTest" documents included in the project. There's a lot of NDoc'ed
docs as well.

Send me any questions / comments at the address below.

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
Nov 15 '05 #4
Looks extremely professional and fully featured Michael! Sorry havent had
too much time to look at the code as Im a poor student and having to work
hard to pay off last terms debt :p Will have a better rummage when I can
although it looks pretty quick to generate a report from a small amount of
code.

This is basically what I've been looking for, a very cut down version of
crystal but without the bells and whistles. Oh by the way, have you managed
to solve the age old .NET printing problem of working out how many pages are
in a document so that you can do a Page 1 of 5 or whatever? That one had me
stumped for ages...

Kieran
"Michael Mayer" <mi**@mag37.com> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
The first public version of "ReportPrinting" is now released. This is
beta-code. Maybe not even that. It works for me, but I'm curious to see
reactions from others.

http://www.mag37.com/csharp/articles/Printing/

I'll work on getting a simple tutorial up and running. For now, I'd suggest reading the two links under Documentation, and then looking through the 5
"ReportTest" documents included in the project. There's a lot of NDoc'ed
docs as well.

Send me any questions / comments at the address below.

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com

Nov 15 '05 #5
"Kieran Benton" <ki**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Looks extremely professional and fully featured Michael! Sorry havent had
too much time to look at the code as Im a poor student and having to work
hard to pay off last terms debt :p Will have a better rummage when I can
although it looks pretty quick to generate a report from a small amount of
code.
This is basically what I've been looking for, a very cut down version of
crystal but without the bells and whistles.
Thanks for the compliment.
Oh by the way, have you managed
to solve the age old .NET printing problem of working out how many pages are in a document so that you can do a Page 1 of 5 or whatever? That one had me stumped for ages...


No, I haven't figured that one out. Everything that comes to mind now seems
like a big pain in the butt. Any suggestions?

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com


Nov 15 '05 #6
There are only two ways of doing this as far as I can see:

1. Do a behind the scenes printpreview before any printing operation and
check how many pages you have (big pain in butt and not exactly elegant)

2. Calculate how much space everything will take up before you even begin
printing (horrendously big pain in the butt but slightly more elegant)

Does anyone else have any ideas?

Regards,
Kieran

"Michael Mayer" <mi**@mag37.com> wrote in message
news:uS*************@TK2MSFTNGP10.phx.gbl...
"Kieran Benton" <ki**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Looks extremely professional and fully featured Michael! Sorry havent had too much time to look at the code as Im a poor student and having to work hard to pay off last terms debt :p Will have a better rummage when I can
although it looks pretty quick to generate a report from a small amount of code.
This is basically what I've been looking for, a very cut down version of
crystal but without the bells and whistles.
Thanks for the compliment.
Oh by the way, have you managed
to solve the age old .NET printing problem of working out how many pages

are
in a document so that you can do a Page 1 of 5 or whatever? That one had

me
stumped for ages...


No, I haven't figured that one out. Everything that comes to mind now

seems like a big pain in the butt. Any suggestions?

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com

Nov 15 '05 #7
Well, I just released version 0.3. Much better than pervious versions (if I
do say so myself). Let me know of any comments you have (if you are using
it or not, etc)

Current release ver. 0.3, 5-Sep-03
http://www.mag37.com/csharp/articles/Printing/

Quite a few fixes:
Fixed PageFooter problem (they became headers).
Completely reorganized the call structure of ReportSection. Separated sizing
from printing methods. Cleaned up a lot of code.
Added ReportSectionLine
Added ability to do columns of text.
Added Margins to abstract ReportSection class.
Orphaned header rows shouldn't print (untested).

--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
"Dennis C. Drumm" <de*******@primacode.com> wrote in message
news:u0**************@TK2MSFTNGP11.phx.gbl...
I was wondering if someone could suggest were/how I could get started with
setting up printing of a collection of text that includes tables from a grid and other supporting information about the grid's contents. If you could
just point me at the classes that I should consider and some very broad
guidelines that would be great. For instances, would a good approach be to
build an rich text document somehow with the proper formatting and then
print that? I would really like to print the grid stuff as tables with lines marking the grid.

Thanks,

Dennis

Nov 15 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: george lewycky | last post by:
I have Oracle Apps ( AR & GL) and I working on creating our own Invoice but I'm unsure about certain aspects of PL/SQL & Printing. I have some PL/SQL working with the invoice data from...
0
by: Bob Greschke | last post by:
Howdy! I have a Python/MySQL program that produces HTML pages from some items in our inventory database. These pages are varying numbers of 1-row, 3-column tables whose first column is a...
2
by: David | last post by:
Call me thick, but I am still having a problem with the Print Concept. It just never came up. What I guess I need, is a step by step explination starting with a dataset, and ending with a text...
1
by: Smitha Nataraj | last post by:
Hello, Please let me know if you have the solution for a similar kind of problem... Background: I have an aspx page which is used as a report i.e. will be used for printing some information....
10
by: Fabian Steiner | last post by:
Hello! I am currently working on an application where the user is able to create new worksheets and to delete existing ones. All of these worksheets have the same structure (--> template?), only...
6
by: J Ames | last post by:
I have an ASP.NET (VB) form that has two drop downs, a horizontal rule and a button. The button invokes a stored procedure and several tables are created on the page with data populated. I want...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
7
by: johnacooke | last post by:
The W3C added THEAD, TFOOT and TBODY elements to facilitate the printing of long tables, so that header and footer information could be repeated on each page. While I have seen this discussed...
1
by: Glenn | last post by:
I am writing a program for field work that will use a receipt printer. I need to be able to adjust the page settings prior to printing depending on how much needs to be printed. I have been able...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.