1 Reply Latest reply on Mar 17, 2010 4:29 AM by bsagarvidya123

    Converting datagrid to PDF without changing the order of headers

    sathiyabala Level 1

      Hai

       

            I have converted the flex datagrid to PDF using Alive PDF, i can get the datas displayed in the PDF Format.

       

           But i have the headers of the datagrid in random way i.e not in alphabetical order, but in the PDF the headers are displayed in the  alphabetical order.

       

           This is my problem , i need it as such in the datagrid , how to change it...

       

           I have attached the sample code below.

          

          Can any one help me....

       

       

       

       

      Thanks in Advance  

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      var

       

       

      displayMode:String = Display.FULL_PAGE;

       

       

      var

      howToOutput:String = Download.ATTACHMENT;

       

       

      var

      howToResize:String = ResizeMode.NONE

       

       

      var serverScript:String = contextPath+"/CreatePDFServlet"

      ;

      printPDF =

       

      new

      PDF(orientation, Unit.MM, Size.A4);

      printPDF.addPage();

      printPDF.setDisplayMode(displayMode, Layout.SINGLE_PAGE);

      printPDF.textStyle(

       

      new

      RGBColor(0x000000));

      printPDF.setFont(FontFamily.HELVETICA,Style.BOLD);

      printPDF.setFontSize(08);

      printPDF.setXY(1,1);

      printPDF.setFontSize(12);

      printPDF.setMargins(10,10,10,10);

      printPDF.addText(

       

      "DataGridDetail"

      ,07,07);

      printPDF.setFontSize(08);

       

       

      var gridcollection:ArrayCollection = adhocdetailgridcompilance.dataProvider as

      ArrayCollection;

       

       

      var detailgrid:Grid = new Grid (gridcollection.toArray(),100,100, new RGBColor (0x778899), new RGBColor (0xFFFFFF), new RGBColor ( 0x0 ), false, new

      RGBColor ( 0x0 ));

       

       

      var gridcolumns:Array = new

      Array();

       

       

      var

      i:int;

       

       

      for

      (i=0;i<gridcollection.length;i++){

      gridcolumns[i] =

       

      new GridColumn(gridcollection[i],gridcollection[i],50,'L','L'

      );

      }

      printPDF.addGrid(detailgrid,printPDF,

       

      'ACD'

      ,0,0);

      printPDF.save(Method.REMOTE, serverScript, howToOutput,

       

      'report.pdf'

      );