• flex 分页打印表格功能


    private function printHandler():void{
                var printJob:FlexPrintJob = new FlexPrintJob();
                printJob.printAsBitmap = true;
                if (printJob.start()){
                        var myPrintData:PrintDataGrid=new PrintDataGrid();
                        var dataCol:DataGridColumn = new DataGridColumn();
                        dataCol.headerText = "序号";
                        dataCol.dataField= "NUM";
                        dataCol.width = 60;
                        var dataCol0:DataGridColumn = new DataGridColumn();
                        dataCol0.headerText = "拐点号";
                        dataCol0.dataField= "GDH";
                        dataCol0.width = 60;
                        var dataCol1:DataGridColumn = new DataGridColumn();
                        dataCol1.headerText = "X_坐标(起标高)";
                        dataCol1.dataField= "XZB";
                        dataCol1.width = 125;
                        var dataCol2:DataGridColumn = new DataGridColumn();
                        dataCol2.headerText = "Y_坐标(止标高)";
                        dataCol2.dataField= "YZB";
                        dataCol2.width = 125;
                        var dataCol3:DataGridColumn = new DataGridColumn();
                        dataCol3.headerText = "矿体标识";
                        dataCol3.dataField= "KTBS";
                        dataCol3.width = 220;
                        var dataCol4:DataGridColumn = new DataGridColumn();
                        dataCol4.headerText = "性质";
                        dataCol4.dataField= "XZ";
                        dataCol4.width = 60;
                        myPrintData.columns = myPrintData.columns.concat(dataCol)
                        myPrintData.columns = myPrintData.columns.concat(dataCol0)
                        myPrintData.columns = myPrintData.columns.concat(dataCol1);
                        myPrintData.columns = myPrintData.columns.concat(dataCol2);
                        myPrintData.columns = myPrintData.columns.concat(dataCol3);
                        myPrintData.columns = myPrintData.columns.concat(dataCol4);
                        Application.application.addChild(myPrintData);
                        myPrintData.dataProvider = dgCoord.dataProvider;
                        myPrintData.width=printJob.pageWidth;
                        myPrintData.height=printJob.pageHeight;
                        myPrintData.sizeToPage = true;
                        printJob.addObject(myPrintData);
                        while(myPrintData.validNextPage){
                            myPrintData.nextPage();
                            printJob.addObject(myPrintData);
                        }
                        Application.application.removeChild(myPrintData);
                        printJob.send();
                   }
            }
    
    <mx:DataGrid id="dgCoord" right="0" bottom="30" top="30"  left="0" editable="true" width="100%" 
    			visible="true" draggableColumns="false" sortableColumns="false" fontFamily="微软雅黑" fontWeight="normal" 
    			allowMultipleSelection="true" color="#0b333c" borderThickness="0"
    			fontStyle="normal" textDecoration="normal" fontSize="12">
    		<mx:columns>
    				<mx:DataGridColumn headerText="序号" dataField="NUM" width="10" editable="false" textAlign="center"/>	
    				<mx:DataGridColumn headerText="拐点号" dataField="GDH" width="10" textAlign="center"/>			
    				<mx:DataGridColumn headerText="X_坐标(起标高)" dataField="XZB" width="23" textAlign="center"/>
    				<mx:DataGridColumn headerText="Y_坐标(止标高)" dataField="YZB" width="23" textAlign="center"/>
    				<mx:DataGridColumn headerText="矿体标识" dataField="KTBS" width="18" textAlign="center"/>
    				<mx:DataGridColumn headerText="性质" dataField="XZ" width="10" textAlign="center"/>				
    		</mx:columns>
    	</mx:DataGrid>
    

     PrintDataGrid是分页打印不可缺少的部分。

    多看一行书,就少写一行代码,记录点滴,用心生活。
  • 相关阅读:
    数组
    Java读取键盘输入
    Java不同类型字符转换String/int/Float/////
    微信公众号第三方验证的代码实现
    Debian Tips【在Debian下使用dos2unix、unix2dos、ifconfig、Adobe Flash Player、蓝牙音响等工具】
    数组的三种方式总结 多维数组的遍历 Arrays类的常用方法总结
    java基本数据类型总结 类型转换 final关键字的用法
    Maven通解
    IDEA——错误: 找不到或无法加载主类 com.Main
    Docker安装mysql,redis,mongodb数据库,docker常用命令,以及更换阿里镜像地址
  • 原文地址:https://www.cnblogs.com/aegisada/p/4270885.html
Copyright © 2020-2023  润新知