FlexPrintJob and paging Printing

Source: Internet
Author: User

First import mx. printing. FlexPrintJob;
Import mx. printing. PrintAdvancedDataGrid;
1. Use FlexPrintJob to print
1. If there is no paging or drop-down box Copy codeThe Code is as follows: public function doPrint (): void {
Var printer: FlexPrintJob = new FlexPrintJob ();
If (printer. start ()){
Printer. addObject (body );
Printer. send ();
}
}

This method can be used below. Because I am using Flex3, there is no label "PrintDataGrid" in Flex3, and only "PrintAdvancedDataGrid ". The following three methods are used: ("PrintAdvancedDataGrid", "AdvancedDataGrid", and "DataGrid"). Remember that the above method is only applicable to a single page (with less data) and there is no drop-down box.Copy codeThe Code is as follows: <mx: PrintAdvancedDataGrid id = "body" x = "188" y = "232">
<Mx: columns>
<Mx: AdvancedDataGridColumn dataField = "username"/>
<Mx: AdvancedDataGridColumn dataField = "password"/>
</Mx: columns>
</Mx: PrintAdvancedDataGrid>

Bytes --------------------------------------------------------------------------------------
[/Code]
<Mx: AdvancedDataGrid id = "body" x = "188" y = "232">
<Mx: columns>
<Mx: AdvancedDataGridColumn dataField = "username"/>
<Mx: AdvancedDataGridColumn dataField = "password"/>
</Mx: columns>
</Mx: AdvancedDataGrid>
[/Code]
Bytes -----------------------------------------------------------------------------------------Copy codeThe Code is as follows: <mx: DataGrid id = "body" x = "188" y = "232">
<Mx: columns>
<Mx: DataGridColumn dataField = "username"/>
<Mx: DataGridColumn dataField = "password"/>
</Mx: columns>
</Mx: DataGrid>

Certificate ----------------------------------------------------------------------------------------------------------------------------------------------------------
If you want to use the paging effect, you must use the label "PrintAdvancedDataGrid" (the label in Flex3) to achieve the paging effect.Copy codeThe Code is as follows: private function doPrint (): void {
Var PrintJob: FlexPrintJob = new FlexPrintJob ();
If (PrintJob. start ()){
AddChild (body );
// Set the print view attributes
While (true ){
PrintJob. addObject (body );
If (body. validNextPage ){
Body. nextPage ();
} Else {
Break;
}
}
}
PrintJob. send ();
}

The corresponding label of this method is:Copy codeThe Code is as follows: <mx: PrintAdvancedDataGrid id = "body" x = "188" y = "232">
<Mx: columns>
<Mx: AdvancedDataGridColumn dataField = "username"/>
<Mx: AdvancedDataGridColumn dataField = "password"/>
</Mx: columns>
</Mx: PrintAdvancedDataGrid>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.