I've used a invisible viewstack to store datagrids with good dataprovider to fit in a page. A listener on creationcomplete adds a page and inserts the image.
thomas parquier --- http://www.web-attitude.fr/realisations/ msn : thomas.parqu...@web-attitude.fr softphone : sip:webattit...@ekiga.net <sip%3awebattit...@ekiga.net> téléphone portable : +33601 822 056 2009/12/8 Vitor Cunha <vitorpopo...@hotmail.com> > > > Hello, > I'm having problems trying to insert the contents of a DataGrid in a PDF > generated with AlivePDF. I'm not using AlivePDF grid component because my > DataGrid has many customizations, like grouped headers, etc. The difficulty > is that the Datagrid conten is large, and would take more than one page in > the PDF. > I use the addImage method ( myPDF.addImage(DataGrid) ) to draw the DataGrid > in the PDF. When I have to create a new page in the PDF, I modify the > dataProvider, slicing the array so the DataGrid shows the contents of the > next page, and I call the addImage method again. This time, the DataGrid > image added to the PDF didn't change, it's the same as the first image. It > looks like the DataGrid wasn't updated. > Here's a part of the code that generates the PDF : > > > myPDF = > *new* PDF(Orientation.LANDSCAPE,Unit.MM,Size.A4); > > myPDF.setDisplayMode(Display.FULL_PAGE, Layout.SINGLE_PAGE ); > > ** > > *var* newPage:Page; > > ** > > */* Calculate the number of pages*/* > > numPages = (dataGrid.height/dataGrid.rowHeight)-1; > > intPages = Math.ceil(dataProvider.length/numPages); > > * * > > *for*( *var* i:uint = 0; i < intPages; i++){ > > > > * /* Add a new page in the PDF */* > > newPage = > *new* Page(Orientation.LANDSCAPE, Unit.MM, Size.A4 ); > > myPDF.addPage(newPage); > > > > * /* Refresh the dataProvider */* > > Data = > *new* ArrayCollection(ArrData.source.slice((i * numPages),(i * numPages) + > numPages) ); > > dataGrid.dataProvider = Data; > > Data.refresh(); > > > > * /* Insert the grid image in the dataGrid */* > > myPDF.addImage(dataGrid); > > } > > > > Is there a way to update the dataGrid image so I can insert multiple pages > correctly in the PDF? > > > > Thanks, > > Vitor. > > ------------------------------ > Agora a pressa é amiga da perfeição. Chegou Windows 7. > Conheça.<http://www.microsoft.com/brasil/windows7/default.html?WT.mc_id=1539> > >