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.
Unfortunately, activation email could not send to your email. Please try again.

custom grid print class

Thread ID:

Created:

Updated:

Platform:

Replies:

21628 Nov 16,2004 08:52 AM Nov 17,2004 09:42 AM Windows Forms 4
loading
Tags: GridControl
Gordon Rhea
Asked On November 16, 2004 08:52 AM

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 11:16 AM

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 11:51 AM

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 05:57 PM

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 09:42 AM

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

CONFIRMATION

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.

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.

;