2013-02-12 3 views
0

Мне нужно распечатать следующий файл данных на странице формата A4. Это не соответствует размеру страницы, и датапровердер не работает для printdatagrid.Pleasecorrect me.Проблема с печатью с печатью Flex с размером страницы

enter image description here

Текущий результат:

enter image description here

Моя сетка данных:

<mx:DataGrid id="dashboardList" width="100%" height="95%" 
              alternatingItemColors="[0x373737, 0x373737]" 
              borderColor="#FFFFFF" borderStyle="inset" 
              chromeColor="#295A7D" contentBackgroundColor="#373737" 
              dataProvider="{allTrancList}" fontWeight="normal" 
              horizontalGridLineColor="#858585" click="productDatagrid_clickHandler(event)" 
              horizontalGridLines="true" variableRowHeight="true" 
              wordWrap="true"> 
            <mx:columns> 
             <mx:DataGridColumn width="60" headerText="S.No" 
                  labelFunction="serialNoLabelFunc2"/>         
             <mx:DataGridColumn width="60" dataField="trancCode" 
                  headerText="Order ID"/> 
             <mx:DataGridColumn dataField="date" headerText=" Date" 
                  labelFunction="getDateLabel"/> 
             <mx:DataGridColumn dataField="clientName" 
                  headerText="Client name"/> 
             <mx:DataGridColumn width="90" dataField="clientCode" 
                  headerText="Client code"/> 
             <mx:DataGridColumn dataField="itemType" 
                  headerText="Work/Product"/> 
             <mx:DataGridColumn width="60" dataField="itemNumbers" 
                  headerText="Count"/> 

             <mx:DataGridColumn dataField="cost" headerText="Cost"/> 

             <mx:DataGridColumn dataField="discountAmount" 
                  headerText="Discount"/> 
             <mx:DataGridColumn dataField="tax" headerText="Tax"/> 

             <mx:DataGridColumn dataField="total" headerText="Total"/> 

             <mx:DataGridColumn dataField="paymondmode" 
                  headerText="Payment mode"/> 
            </mx:columns> 
           </mx:DataGrid> 

Мой PrintData сетки:

<mx:PrintDataGrid id="myDataGrid" width="99%" height="100%"> 
     <mx:columns> 

      <mx:DataGridColumn width="60" dataField="trancCode" 
           headerText="Order ID"/> 

      <mx:DataGridColumn dataField="clientName" 
           headerText="Client"/> 
      <mx:DataGridColumn width="90" dataField="clientCode" 
           headerText="Client code"/> 
      <mx:DataGridColumn dataField="itemType" 
           headerText="Type"/> 
      <mx:DataGridColumn width="60" dataField="itemNumbers" 
           headerText="Count"/> 

      <mx:DataGridColumn dataField="cost" headerText="Cost"/> 

      <mx:DataGridColumn dataField="discountAmount" 
           headerText="Discount"/> 
      <mx:DataGridColumn dataField="tax" headerText="Tax"/> 

      <mx:DataGridColumn dataField="total" headerText="Total"/> 

      <mx:DataGridColumn dataField="paymondmode" 
           headerText="Payment mode"/> 
     </mx:columns> 
    </mx:PrintDataGrid> 

Мой код для печати:

var thePrintView:FormPrintView = new FormPrintView(); 
        addElement(thePrintView); 

        // Set the print view properties. 
        thePrintView.width=printJob.pageWidth; 
        thePrintView.height=printJob.pageHeight; 
        thePrintView.prodTotal = prodTotal; 

        // Set the data provider of the FormPrintView 
        // component's DataGrid to be the data provider of 
        // the displayed DataGrid. 
       // thePrintView.myDataGrid=PrintDataGrid(dashboardList); 
        thePrintView.myDataGrid.dataProvider =allTrancList; 
+0

иметь вас попробовал параметр variableRowHeight = "true" wordWrap = "true" на PrintDataGrid и установил другие свойства так же, как вы сделали для datagrid dashboardList. Например: -

ответ

2

Вы можете искать AlivePDF или PurePDF, оба варианта предоставит вам больше места, чтобы расправить крылья с большим количеством возможностей и может удовлетворить постоянно меняющиеся требования.

Вы найдете ниже код (этот код просто понимание о возможности в отношении вашего требования, и вы можете найти всю LIB тестовых файлов с purePDF сайта [связана выше]) -

package 
{ 
import flash.events.Event; 

import org.purepdf.colors.RGBColor; 
import org.purepdf.elements.Paragraph; 
import org.purepdf.elements.RectangleElement; 
import org.purepdf.pdf.PdfPCell; 
import org.purepdf.pdf.PdfPTable; 

public class PdfPTableColors extends DefaultBasicExample 
{ 
    public function PdfPTableColors(d_list:Array=null) 
    { 
     super(["Customize border and background color","of table cells"]); 
    } 

    override protected function execute(event:Event=null):void 
    { 
     super.execute(); 
     createDocument(); 
     document.open(); 

     registerDefaultFont(); 

     var table: PdfPTable = new PdfPTable(4); 
     table.widthPercentage = 100; 
     var cell: PdfPCell; 
     cell = PdfPCell.fromPhrase(new Paragraph("test colors:")); 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("red/no borders")); 
     cell.border = RectangleElement.NO_BORDER; 
     cell.backgroundColor = RGBColor.RED; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("green/magenta bottom border")); 
     cell.border = RectangleElement.BOTTOM; 
     cell.borderColorBottom = RGBColor.MAGENTA; 
     cell.borderWidthBottom = 10; 
     cell.backgroundColor = RGBColor.GREEN; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("blue/cyan top border + padding")); 
     cell.border = RectangleElement.TOP; 
     cell.useBorderPadding = true; 
     cell.borderWidthTop = 5; 
     cell.borderColorTop = RGBColor.CYAN; 
     cell.backgroundColor = RGBColor.BLUE; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("test GrayFill:")); 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("0.25")); 
     cell.border = RectangleElement.NO_BORDER; 
     cell.grayFill = 0.25; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("0.5")); 
     cell.border = RectangleElement.NO_BORDER; 
     cell.grayFill = 0.5; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("0.75")); 
     cell.border = RectangleElement.NO_BORDER; 
     cell.grayFill = 0.75; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("test bordercolors:")); 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("different borders")); 
     cell.borderWidthLeft = 6; 
     cell.borderWidthBottom = 5; 
     cell.borderWidthRight = 4; 
     cell.borderWidthTop = 2; 
     cell.borderColorLeft = RGBColor.RED; 
     cell.borderColorBottom = RGBColor.ORANGE; 
     cell.borderColorRight = RGBColor.YELLOW; 
     cell.borderColorTop = RGBColor.GREEN; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("with correct padding")); 
     cell.useBorderPadding = true; 
     cell.borderWidthLeft = 6; 
     cell.borderWidthBottom = 5; 
     cell.borderWidthRight = 4; 
     cell.borderWidthTop = 2; 
     cell.borderColorLeft = RGBColor.RED; 
     cell.borderColorBottom = RGBColor.ORANGE; 
     cell.borderColorRight = RGBColor.YELLOW; 
     cell.borderColorTop = RGBColor.GREEN; 
     table.addCell(cell); 

     cell = PdfPCell.fromPhrase(new Paragraph("orange border")); 
     cell.borderWidth = 6; 
     cell.borderColor = RGBColor.ORANGE; 
     table.addCell(cell); 

     document.add(table); 
     document.close(); 
     save(); 
    } 
} 
} 
+0

Можете ли вы дать ссылку на adobe образец воздуха.? – Naju

Смежные вопросы