tags:

views:

1398

answers:

3

I have a report I need to print from a Flex Project I have written. The report needs to look like this:

 Header
 -----------
 text, more text

 .----------------------------.
 |Data Grid of Variable Height|
 |============================|
 |                            |
 |                            | 
 |~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
  Possible Page Break
 .~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
 |                            | 
 |                            |
 |____________________________|

 Fixed height chart

 Lots more text
 End

I have spent about 16 hours trying to get this working. Every example I have found either has a PrintDataGrid a fixed height of 100% of its container, and then doing some really verbose code to span it to multiple pages. Has anyone gotten anything like this to work? I am considering just making a webservice that takes the data and spits it back in Html, but I would have to recreate the chart.

+1  A: 

You can't. Don't even try and print in flex.

Shawn Simon
Printing in flex (and html in the browser) is a whole can of worms that should be avoided at all cost. If you're going to take a route other than flex, you'll have more consistent results with a pdf. Try taking a look at a library like iText if you're going to make a webservice.
mweiss
A: 

I'm not sure what you mean by verbose, but check out the pseudocode and implementation at http://www.brucephillips.name/blog/index.cfm/2008/4/11/Flex--Printing-A-DataGrid-That-Spans-Multiple-Printed-Pages.

Dan R
Tried that before, it doesn't work, because it assumes there's nothing below the grid. The quality is poor as well. Seriously it is not worth the time to print in Flex. We just created a server method that prints the data in html.
Shawn Simon
A: 

Hi cross a web site wich coul be interesting for this problem : Printing Multiple Pages using FlexReport

Hope it would help

LE GALL Benoît