flex打印操作(FlexPrintJob)還有分頁(yè)打印操作具體實(shí)現(xiàn)
import mx.printing.PrintAdvancedDataGrid;
1.使用FlexPrintJob進(jìn)行打印操作
1.如果沒(méi)有分頁(yè)和下拉框的時(shí)候
public function doPrint():void{
var printer:FlexPrintJob = new FlexPrintJob();
if(printer.start()){
printer.addObject(body);
printer.send();
}
}
這個(gè)方法即可 下面的可以使用,由于我使用的是Flex3,Flex3里面沒(méi)有標(biāo)簽“PrintDataGrid”,只有“PrintAdvancedDataGrid”。所以下面就使用(“PrintAdvancedDataGrid”,“AdvancedDataGrid ”,“DataGrid ”)這三種方式,切記上面的方式只適合于單個(gè)頁(yè)面(數(shù)據(jù)較少)且沒(méi)有下拉框
<mx:PrintAdvancedDataGrid id="body" x="188" y="232">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="username"/>
<mx:AdvancedDataGridColumn dataField="password"/>
</mx:columns>
</mx:PrintAdvancedDataGrid>
--------------------------------------------------------------------------------------
[/code]
<mx:AdvancedDataGrid id="body" x="188" y="232">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="username"/>
<mx:AdvancedDataGridColumn dataField="password"/>
</mx:columns>
</mx:AdvancedDataGrid>
[/code]
-----------------------------------------------------------------------------------------
<mx:DataGrid id="body" x="188" y="232">
<mx:columns>
<mx:DataGridColumn dataField="username"/>
<mx:DataGridColumn dataField="password"/>
</mx:columns>
</mx:DataGrid>
----------------------------------------------------------------------------------------------------------------------------------------------------------
如果要使用分頁(yè)效果,則必須使用標(biāo)簽"PrintAdvancedDataGrid"(Flex3中的標(biāo)簽)才能夠?qū)崿F(xiàn)分頁(yè)效果
private function doPrint():void{
var PrintJob:FlexPrintJob = new FlexPrintJob();
if(PrintJob.start()){
addChild(body);
//設(shè)置的打印視圖屬性
while(true){
PrintJob.addObject(body);
if(body.validNextPage){
body.nextPage();
}else{
break;
}
}
}
PrintJob.send();
}
這個(gè)方法,所對(duì)應(yīng)的標(biāo)簽是:
<mx:PrintAdvancedDataGrid id="body" x="188" y="232">
<mx:columns>
<mx:AdvancedDataGridColumn dataField="username"/>
<mx:AdvancedDataGridColumn dataField="password"/>
</mx:columns>
</mx:PrintAdvancedDataGrid>
相關(guān)文章
flex實(shí)現(xiàn)股票行情走勢(shì)圖示例代碼
股票行情走勢(shì)圖在flex中也可以實(shí)現(xiàn)了,具體步驟及代碼如下,感興趣的朋友可以參考下,或許有所幫助2013-10-10Flex中的HDividedBox和VDividedBox的比較附圖
學(xué)習(xí)Flex的朋友對(duì)HDividedBox和VDividedBox并不陌生吧,下面是兩者的簡(jiǎn)單比較,感興趣的朋友可以參考下2013-10-10Flex父子窗口相互調(diào)用實(shí)現(xiàn)思路及源碼
這篇文章主要介紹了Flex父子窗口相互調(diào)用實(shí)現(xiàn)思路及源碼,需要的朋友可以參考下2014-05-05Flex4 DataGrid中嵌入RadioButton實(shí)現(xiàn)思路及代碼
本節(jié)主要介紹了Flex4 DataGrid中嵌入RadioButton實(shí)現(xiàn)思路及代碼,需要的朋友可以參考下2014-07-07flex4 panel去掉標(biāo)題設(shè)置透明度效果代碼
首先:去掉Panel的標(biāo)題,其次:設(shè)置透明度這個(gè)說(shuō)了也是啰嗦,大家都會(huì),不過(guò)還是提一下吧,具體請(qǐng)祥看本文2013-05-05flex 遍歷Object對(duì)象內(nèi)容的實(shí)現(xiàn)代碼
這篇文章主要介紹了flex 遍歷Object對(duì)象內(nèi)容的實(shí)現(xiàn)代碼,需要的朋友可以參考下2014-07-07Flex 事件分發(fā)(FlexViewer事件機(jī)制)剝離過(guò)程
本節(jié)主要介紹了如何將FlexViewer里面的事件分發(fā)及監(jiān)聽(tīng)事件機(jī)制剝離出來(lái)在其他項(xiàng)目中使用,需要的朋友可以參考下2014-07-07flex實(shí)現(xiàn)DataGrid高亮顯示數(shù)據(jù)功能的解決方案
原生的DataGrid根本無(wú)法達(dá)到所要的效果,目前一般就是來(lái)改寫(xiě)原生的DataGrid,只需重新寫(xiě)一個(gè)類(lèi)來(lái)重寫(xiě)drawRowBackground方法就可以了2013-10-10flex中event.preventDefault()方法取消事件的默認(rèn)行為
當(dāng)點(diǎn)擊datagrid的第一和第四項(xiàng)時(shí),itemEdit事件將不起作用,許多事件都有默認(rèn)執(zhí)行的關(guān)聯(lián)行為,接下來(lái)為大家詳細(xì)介紹下,感興趣的朋友可以參考下哈2013-04-04