We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

custom grid print class

Thread ID:





21628 Nov 16,2004 01:52 PM UTC Nov 17,2004 02:42 PM UTC WinForms 4
Tags: GridControl
Gordon Rhea
Asked On November 16, 2004 01:52 PM UTC

Hi, I''m writing a custom class to handle grid printing. What it needs to do is to accept an array of grids to print and display them all (not on the same page) correctly in a print preview window to the user with header and footer text. The KB articles were extremely helpful but didn''t completely get me what I wanted. I''m calculating the start/end rows and the start/end columns for each page then using OnDrawClientRowCol to draw the grid onto print graphics object. This works fine for grids that only take up one page. When I try to print a grid that takes up two pages it doesn''t work. What is happening on a grid with 99 rows it prints the first page correctly but the second page it prints the header row and rows 1 and 2 and nothing else from the grid. I have verified that I am passing rows 1-51 into the first page and rows 52-99 on the second page in the OnDrawClientRowCol parameters. I am having similar problems on printing a grid with columns that need to be printed on a second page. The first page is correct but the second page has the columns from the first page and the columns for the second page added to the end to the edge of the print page. What do I need to do to get OnDrawClientRowCol to correctly draw the second pages for these grids? Or do I need to use another method to draw the grid onto the print graphic? Thanks, Gordon

Administrator [Syncfusion]
Replied On November 16, 2004 04:16 PM UTC

Before calling OnDrawClientRowCol, make sure grid.PrintingMode = true. Then explicilty set grid.PrintInfo.m_awPageFirstCol and grid.PrintInfo.m_awPageFirstRow to point to your top-left cell for the page.

Gordon Rhea
Replied On November 16, 2004 04:51 PM UTC

I''m still having a similar problem. The only difference is that now page 2 is showing no rows instead of rows 1 and 2. I''m attaching a sample app that shows what''s going on. Thanks, Gordon GridPrintTest_8330.zip

Administrator [Syncfusion]
Replied On November 16, 2004 10:57 PM UTC

The OnDrawClientRowCol method accepts client rows, so you cannot pass in abosute rows like 51 to 100. It is always something like 0 to 50. If you own the source code, you can check out the code in GridPrintDocument.OnPrintPage. It uses OnDrawClienRowCol, but always passes in 0, 0, bottomRow, rightCol. The code preceding the call sets things up so the call prints properly. I think you will have to try to use the same technique in your code to set up the call.

Gordon Rhea
Replied On November 17, 2004 02:42 PM UTC

Thanks Clay. Calculating the client rows fixed the problems. Gordon


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon