chengse66 / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

PDF not displaying 4th column data in datagrid. #355

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When saving a PDF, all of the elements are visible (header imaage, image, and 
datagrid) except it seems to always omit the data from the 4th column.  

private function printPDF(event:MouseEvent):void
{
   var PDFcolumns:Array = getPDFColumns(_dataGrid);
   var resultsArray:Array = _dataGrid.dataProvider.toArray();
   var pdf:PDF  = new PDF(Orientation.PORTRAIT,Unit.MM,Size.LETTER);

   pdf.addPage();
   pdf.setFont(new CoreFont(),10);
   pdf.textStyle(new RGBColor(0x000000));

   var grid:Grid = new Grid(_dataGrid.dataProvider.toArray(),0,_dataGrid.height,new RGBColor(0xDDDDDD),
                    new RGBColor(0xF9F9F9), new RGBColor(0xFFFFFF), true, new
                    RGBColor(0x000000), 1);

                grid.columns = PDFcolumns;

     pdf.setFont(new CoreFont(),10);
     pdf.textStyle(new RGBColor(0x000000));
     pdf.addGrid(grid,0,160);          

    var ba:ByteArray = pdf.save(Method.LOCAL);
    var fr:FileReference = new FileReference();

    fr.save(ba, "savedconfig.pdf");
}

private function getPDFColumns(datagrid:DataGrid):Array
{

   var PDFcolumns:Array = new Array;         
   var dataGridColumn:DataGridColumn;

   for( var i:Number = 0; i < datagrid.columns.length; i++ ) 
    {
       dataGridColumn = datagrid.columns[i];

       if (dataGridColumn.visible)
       {
          var gridColumn:GridColumn = new  GridColumn(dataGridColumn.headerText,
                            dataGridColumn.dataField, 
                            dataGridColumn.width * 0.27);

          PDFcolumns.push(gridColumn);
         }
       }
    return PDFcolumns;
}

What steps will reproduce the problem?
1. Apply the code above.
2. After saving the PDF, the PDF will show the missing data.

What is the expected output? What do you see instead?

The datagrid to display the data in all of the columns

What version of the product are you using? On what operating system?
1.5RC on Windows 7

Please provide any additional information below.

Original issue reported on code.google.com by pbf...@gmail.com on 22 Mar 2012 at 9:39

Attachments: