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?
ADAdministrator Syncfusion Team 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.
GRGordon RheaNovember 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.
ADAdministrator Syncfusion Team 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.
GRGordon RheaNovember 17, 2004 09:42 AM
Calculating the client rows fixed the problems.