【发布时间】:2015-05-07 02:55:10
【问题描述】:
从this 教程我得到了很好的打印结果,this 关于如何从 html 打印多个页面的教程,我正在尝试用 Datagrid 做同样的事情。
我的问题是当行数超过Datagrid 的高度时,我试图将其分解为几页,这是我的代码:
protected function button3_clickHandler(event:MouseEvent):void
{
var success:Boolean = printJob.start2(disablePageRange.selected ? this.printUIOptions : null, false);
var pjo:PrintJobOptions = new PrintJobOptions;
if (methodBitmap.selected){
pjo.printMethod = PrintMethod.BITMAP;
}
else if (methodVector.selected){
pjo.printMethod = PrintMethod.VECTOR;
}
else{
pjo.printMethod = PrintMethod.AUTO;
}
if (printJob.maxPixelsPerInch > 600){
pjo.pixelsPerInch = 600;
}
updateForm();
updateThePage();
updateTheWindow();
//--------------------------------------
var b:int = 0;
var H:int = myDataGrid.rowHeight *2;
for each (var item:Object in meme as ArrayCollection ){
if (H > myDataGrid.height){
myDataGrid.dataProvider = arlst;
printJob.addPage(thePrintableArea, null, pjo);
arlst.removeAll();
H = myDataGrid.rowHeight *2;
b++;
//Alert.show(b.toString());
}else{
arlst.addItem(item);
H += myDataGrid.rowHeight;
}
}
printJob.send();
}
结果:我得到了第一页,但其余的只是空白Datagrid:
【问题讨论】:
标签: actionscript-3 apache-flex datagrid air flex4