473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Printing in C#, need code to accomplish this

Hi All

I have a table with 10 rows and 15 columns...when i click on a button
each row should be printed in a single page with the line break to the
corresponding columns of that particular row...

as an example

page-1
--------
record1--col1
col2
.....
.....
page-2
--------
record2--col1
col2
.....

can any body help me in this

Thanks & Regards
Kalyan

Jul 30 '07 #1
4 1616
Kevin Spencer wrote:
You're going to have problems in a web application. There is a CSS
specification for printing, but it is not supported entirely well by any
browser. Page Breaks, for example, are not supported by Internet Explorer,
even version 7.
Can you clarify this? I use the "page-break-after" style for page
breaks in IE7 without any trouble. I'm pretty sure it worked in IE6
too, though I haven't bothered to go back and check. I don't do a lot
of HTML print layout so I've never bothered to try the other page-break
styles, but given that "page-break-after" works, I suspect they do too.

Pete
Jul 30 '07 #2
Peter Duniho wrote:
Kevin Spencer wrote:
>You're going to have problems in a web application. There is a CSS
specification for printing, but it is not supported entirely well by
any browser. Page Breaks, for example, are not supported by Internet
Explorer, even version 7.

Can you clarify this? I use the "page-break-after" style for page
breaks in IE7 without any trouble. I'm pretty sure it worked in IE6
too, though I haven't bothered to go back and check. I don't do a lot
of HTML print layout so I've never bothered to try the other page-break
styles, but given that "page-break-after" works, I suspect they do too.

Pete
I'm glad you asked that, Pete. I've been doing the same thing since IE
5, first time was about 6 years ago (also with page-break-before).
Worked great (well, as nice looking as CSS "hard-copy reporting"
capabilities allow, as Kevin points out).

--
-glenn-
Jul 30 '07 #3
Kevin Spencer wrote:
Hi Peter,

I'd love to see your CSS, because I haven't been able to get page-breaking
to work in IE 7.
Well, that's simple enough to provide, since I don't do anything fancy.
As an example, if I have a line-break and want the page-break to
happen there as well, I have <br style="page-break-after: always">.

In my case, I've got HTML tables inside divs, one table
inside each div, and each div should have a page break before it, except for
the first page. I'm using an external style sheet in the page header, rather
than an inline style, if that makes any difference.
Could be. Just because IE is respecting the page-break in an inline
style, that wouldn't necessarily mean that IE is handling the
pre-defined style correctly. I do very little HTML authoring myself,
and use CSS in a very simple, sparing way, so there could be all sorts
of IE bugs that I'm unaware of.

I had the impression that Microsoft made a strong effort to bring IE's
compliance with CSS up-to-date for IE7, and I would guess that they
have. But your use of the page-break-XXX styles are clearly more
complicated than what I'm doing, and so it could very well be that there
are still problems in IE7 with using them.

Pete
Jul 31 '07 #4
Thanks for the info, Peter. It's always good to find out what does work in
IE 7 as well as what still doesn't. IE 7 is a significant improvement, but
still has a long way to go, from my experience. Admittedly, the problem
areas are less-travelled, but they do exist. I tend to wander into them a
lot for some reason!

I'm quite thrilled with the XPS format, however. I just hope it gets widely
adopted. OTOH, CSS Print styles have been around for awhile, and are
specific to HTML, so they really need to be broadly supported, which is not
even yet achieved in FireFox (e.g. Orientation style).

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:13*************@corp.supernews.com...
Kevin Spencer wrote:
>Hi Peter,

I'd love to see your CSS, because I haven't been able to get
page-breaking to work in IE 7.

Well, that's simple enough to provide, since I don't do anything fancy. As
an example, if I have a line-break and want the page-break to happen there
as well, I have <br style="page-break-after: always">.

In my case, I've got HTML tables inside divs, one table
>inside each div, and each div should have a page break before it, except
for the first page. I'm using an external style sheet in the page header,
rather than an inline style, if that makes any difference.

Could be. Just because IE is respecting the page-break in an inline
style, that wouldn't necessarily mean that IE is handling the pre-defined
style correctly. I do very little HTML authoring myself, and use CSS in a
very simple, sparing way, so there could be all sorts of IE bugs that I'm
unaware of.

I had the impression that Microsoft made a strong effort to bring IE's
compliance with CSS up-to-date for IE7, and I would guess that they have.
But your use of the page-break-XXX styles are clearly more complicated
than what I'm doing, and so it could very well be that there are still
problems in IE7 with using them.

Pete

Aug 1 '07 #5

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

Similar topics

2
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation...
9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
5
by: VMI | last post by:
I have a BMP image (the form is also in PDF) that contains a scanned copy of a paper form that we need to fill out. Is it possible to use this image in my application so that the application can...
2
by: Jurjen de Groot | last post by:
I'm about to start a new ASP.NET application, this application will generate several types of documents (PDF HTML XML-DOC) wich have to be printed at the client-side... (probably on different...
2
by: Robert Kellogg | last post by:
Hello All, I'm having an issue with printing from AxWebBrowser.ExecWB.. The printing works just fine other then is always print from the default printer.. I'm sure there is a way to accomplish...
2
by: =?Utf-8?B?TUFUVA==?= | last post by:
What i am trying to accomplish is programatically creating Invoices and then Printing them out. I don't really need to "View" them before they print. How I am trying to do this is I have created...
8
by: Frank Rizzo | last post by:
I am trying to print huge images (much bigger than target paper). I try and use e.PageSettings.HardMarginX and e.PageSettings.HardMarginY in the PrintDocument's PrintPage event to try and...
2
by: Brad Pears | last post by:
I have a vb.net 2005 application and am using the print preview screen. This screen has a printer icon on it that the user can use to print the document currently being viewed. It uses the default...
2
by: Matt | last post by:
We have clients asking that we provide an easy way to print envelops from within our web applications. These envelopes need to be pretty advanced, and need to include a bar code and maybe even a...
7
by: Iain Wilson | last post by:
I am pulling my hair out trying to print various objects from a .net web page My apologies for cross posting but I need an answer and my previous post has attracted no interest. ASP.Net 2.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.