2012-05-14 28 views

回答

1

Web示例可以将其转换为AIR: - 请查找示例dataGrid打印以及如何将其更改为250 * 250。因为您只能为打印视图创建自定义组件布局,并将打印组件包含在其中。

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> 
    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 
    <fx:Script> 
     <![CDATA[ 
     import mx.printing.*; 

     // Create a PrintJob instance. 
     private function doPrint():void { 
      var printJob:FlexPrintJob = new FlexPrintJob(); 
      if (printJob.start() != true) 
       return; 
      myDataGridPrint.height = 250; 
      myDataGridPrint.width = 250; 
      myDataGridPrint.dataProvider = myDataGrid.dataProvider; 
      printJob.addObject(myDataGridPrint, FlexPrintJobScaleType.NONE); 
      printJob.send(); 
     } 
     ]]> 

    </fx:Script> 

    <mx:VBox id="myVBox"> 
     <mx:DataGrid id="myDataGrid" width="300"> 
      <mx:dataProvider> 
       <fx:Object Product="Flash" Code="1000"/> 
       <fx:Object Product="Flex" Code="2000"/> 
       <fx:Object Product="ColdFusion" Code="3000"/> 
       <fx:Object Product="JRun" Code="4000"/> 
      </mx:dataProvider> 
     </mx:DataGrid> 
     <!--Print Data Grid--> 
     <mx:DataGrid id="myDataGridPrint" visible="false" includeInLayout="false"/> 
     <mx:Button id="myButton" 
        label="Print" 
        click="doPrint();"/> 
    </mx:VBox> 

</s:Application> 

希望这可以帮助...

+0

谢谢Mahesh。 – Naju

相关问题