Print Grids

Thread ID:

Created:

Updated:

Platform:

Replies:

Hello,I have a variable number of grids to print one after the other on the same PrintDocument.When the fist grid finished printing there should be some withe space and then the second grid should print.

For achieve this result I calculate the space occupied by the first grid on the current page and add it to the PageSettings.Margins.Top for the current page.When I printPreview the document I get the first page of the second grid printed over the first grid and the next pages of the second grid printed correctly at the right position. Why doesn't the first page take into count the new margins i changed?

Hi, I just want to know why if I set the margins on the PrintPageEventArgs.PageSettings.Margins and call the base.OnPrintPage of the GridPrintDocumentClass they are only applied from the second page of the document printed.

>Hello,I have a variable number of grids to print one after the other on the same PrintDocument.When the fist grid finished printing there should be some withe space and then the second grid should print.

For achieve this result I calculate the space occupied by the first grid on the current page and add it to the PageSettings.Margins.Top for the current page.When I printPreview the document I get the first page of the second grid printed over the first grid and the next pages of the second grid printed correctly at the right position. Why doesn't the first page take into count the new margins i changed?

Hi,I've seen the code from the example but what I want to do is a little bit different.What i want to do is to print diffent grids into the same print document. Let's say I have two grids Grid1 and Grid2. Grid1 occupies a page and a half, Grid2 occupies two pages. I want to print all Grid1, that occupies a page and half, and then in the same page start printing Grid2 CALLING THE BASE.PRINT() METHOD of the grids.I've already figured out how to print the grids one after the other, the problems is that when I print Grid2 the print start a the top of the page even if I change the Margin.Top proprieties of the printPageEventArgs.

>Hi Me,

You can print two or more grids in a same page by deriving the GridPrintDocument and overriding its OnPrintPage method. In the override, don't call the base class.

I would strongly encourage you to prepare a small sample just to show the issue, so that we could debug it here. That would help us quicker identify the problem. Or you can modify the sample in the previous reply to show this problem, we can probably suggest some way to avoid it.

This example define a sample grid and a GridPrintDocument.In this example I can see just the first and the last page of the grid ( I suppose it is beacuse I set DeafaultMarginTop to 200 and PageSettingsMargin.Top to 400 ).

Thanks for your help.

>Hi Me,

Thank you for your update.

I would strongly encourage you to prepare a small sample just to show the issue, so that we could debug it here. That would help us quicker identify the problem. Or you can modify the sample in the previous reply to show this problem, we can probably suggest some way to avoid it.

No,It doesn't help. I just wanted to set the margin.Top of the first page of the grid at 400 and the margin.Top of others pages at 100 and print the grid.But when I do this, as you can see in the example, the second page of the grid in the print preview occupies only half of the page and not the entire space available for printing. And also if I do the opposite (Margin.Top of the first page = 100 and of the others page = 400 when I do the print preview I only saw the first and the last page.

We would prefer if you upload the modified source by creating a new Incident with Title "Print Grids -F69407". Or else you can post the modifed code snippets with your question in this thread itself. We will anlayse and update you.