Hello,

I'm using PrintDataGrid to print a DataGrid and everything is working 
fine except one thing. The size (height) of the PrintDataGrid same one 
every page. This would be okay if I were just printing the 
PrintDataGrid, but I have a header on the first page (and footers on 
subsequent pages).

The example code for this (in the "Developing Flex Applications" guide) 
is great and I followed it to a tee (I think). My current solution is to 
manually set the height of the PrintDataGrid after the first page. This 
is a lame solution because I'm doing something like this:

printView.reportsTable.height = printJob.pageHeight - 20;

(If I set the height to printJob.pageHeight I get a scrollbar and my 
footer (with page number) doesn't show.)

Any idea what's causing this?


Here's the pertinent code snippets:

** Application View **

    private function printTable():void {
        var printJob:FlexPrintJob = new FlexPrintJob();

        if (!printJob.start()) { return; }

        var printView:CategoryOrderReportTablePrintView = new 
CategoryOrderReportTablePrintView();
        var pageNumber:int = 1;

        addChild(printView);

        printView.width = printJob.pageWidth;
        printView.height = printJob.pageHeight;
        printView.reports = _reports;
        printView.pageNumber = pageNumber;
        printView.totals = this.calcTotals(this._reports);
        printView.description = this.formatDate(_options.startDate) + " - "
                + this.formatDate(_options.endDate);

        printJob.addObject(printView);

        while (printView.reportsTable.validNextPage) {
            pageNumber++;
            printView.reportsTable.nextPage();
            printView.reportsTable.height = printJob.pageHeight - 20;
            printView.pageNumber = pageNumber;
            printJob.addObject(printView)
        }

        printJob.send();
        removeChild(printView);
    }


** Print View **

    public function set pageNumber(pageNumber:int):void {
        footer.pageNumber = pageNumber;

        if (pageNumber == 1) {
            header.includeInLayout = true;
            header.visible = true;
            footer.includeInLayout = false;
            footer.visible = false;
        } else {
            header.includeInLayout = false;
            header.visible = false;
            footer.includeInLayout = true;
            footer.visible = true;
        }
        validateNow();
    }

Reply via email to