I have 1 wingrid on each page being exported. But the first pages grid has different number of columns then the rest.
The PDF pages widths are not the same. How can I get the pages to be the same size and have the grids fill the width of the pages?
I have been playing around with he grids width size and the columns autoresize properties but no good result as of yet.
At the beginning I set the report objs page size as {2000,1000}. But on do the GridDocExport cmd I see the page size gets reset.
And even if I do a page resize right after that the result is not what I expected.
Hope that made sense.
Deasun
ok thanks.
Will have a look into that.
Okay, so that makes things easier. You don't have to worry about messing up the on-screen layout if your grids are not visible on-screen.
It sounds like you are only creating the grid in order to export to PDF. If that's the case, then another option to consider would be to not use the WinGrids or the UltraGridDocumentExporter at all and simply create a Report yourself and then you can customize it however you want. You could create an IGrid for each of the WinGrids you have now and simply populate the IGrid's with the data you want. You would then have total control over the page size, the size of the grid's etc.
The only down side of this approach is that it's more coding, and also, you don't get all the appearances from the WinGrid into the document automatically. I don't know that maters to you, though, or if you are applying Appearance to the WinGrid rows or cells, anyway.
The gird is built in code in the sub at runtime.
Its the same grid object just a new dataveiw attached to it.
Within loops. :)
And the rows coming back are not more then 10. :)
Hi,
Hm, I don't think this is possible. Or at the very least it will be extremely tricky.
But if you are going to try to make this work, then it seems to me that the first problem you have to solve is how to make all of the sections that same size. That's actually pretty easy. Just be sure to set the PageSize on the section AFTER you export the grid into it.
The problem with explicitly setting the Width of the page is that there's it's very difficult to calculate what the required width is.
If you arbitrarily choose 2000, then you could run into a case where the grid is too wide for the page and some columns are cut off. You also can't just assume that 1000 will be the appropriate height so that the rows will fit on that page. You might be able to calculate the width of the on-screen grid columns and then convert those widths into points. Then you would have to determine the widest grid and then adjust the columns in all of the other grids so that their total width is the same as the widest one.
If you are not too worried about performance, one approach you could take would be to export each grid to a section in a sort've test report. Then record the page sizes of each section. That gives you all the page sizes you need for each grid. Then you could determine the largest page size and then work backward from there. You would then have to increase the size of the columns for all of the other grid's proportionally to make sure the total width is the same as the largest grid.
But it's not that simple, because you probably don't want to change the widths of the grid's on the screen. You only want to change them for exporting. And you also want to make sure that all of the columns are wide enough to show their contents. So you would probably have to turn off AutoSize on the Exporter for the second pass and then AutoSize the columns yourself in the ExportStarted event. Then adjust the width of each column proportional to the largest grid.
Thanks for the reply.
Not sure if you understand what I am trying to do.
On each page I have a grid. On the first page that grid has less columns then will appear on each page after it.
What I want is a all pages in the PDF to be the same size. And each grid to appear to stretch from Left margin to Right margin on its page.
So if I set the Sections Page size say to (2000, 1000), and say the margins are 25.
Then the grids width should be 1950.
But when I do the DocExport Sections Page size resizes itself.
Mgt really wants the pages the same size in landscape and the grids to fit the page. :(