7 Replies Latest reply on Jul 10, 2010 12:56 PM by miguel8312

    print datagrid?

    miguel8312 Level 3

      i have a print function im using on my flex app but when i print the dataprovider i get the name of the dataprovider up on top of my list? is there anyway to print with out that label or change the label?

       

       

      function print():void

      {

       

       

       

      var printJob:FlexPrintJob = new FlexPrintJob();

       

      if (printJob.start())

      {

       

      var printGrid:PrintDataGrid = new PrintDataGrid();

      printGrid.width = printJob.pageWidth;

      printGrid.height = printJob.pageHeight;

       

      //printGrid.columns = populationGrid.columnCount;

      false;

      Application.application.addChild(printGrid);

      printJob.addObject(printGrid);

       

      while (printGrid.validNextPage)

      {

      printGrid.nextPage();

      printJob.addObject(printGrid);

      }

      printJob.send();

      Application.application.removeChild(printGrid);

      }

      }

       

       

      your help is must appreciated.

       

        • 1. Re: print datagrid?
          saisri2k2 Level 4

          could you post the print datagrid code here?

          • 2. Re: print datagrid?
            BhaskerChari Level 4

            Hi miguel8312,

             

            What do you mean exactly by when i print the dataprovider i get the name of the dataprovider do you have any label displaying which is a <mx:Label /> control or is it a part of a DataGrid..??

             

            If you are having a <mx:Label id="lblDataProvider"/> control with id="lblDataProvider" then you can make the label visible property to false....before you send the printObject to the Printer and then after you send the object to printer you can again restore it visible state...so that this will eliminate the label form displaying in the Print output...

             


            So your code should look something like below:

             

            function print():void

             

             

             

            var printJob:FlexPrintJob = new FlexPrintJob();

             

            if (printJob.start())

             

            var printGrid:PrintDataGrid = new PrintDataGrid();

             

            //printGrid.columns = populationGrid.columnCount;

            false;

             

            while (printGrid.validNextPage)

            {

            printGrid.nextPage();

            printJob.addObject(printGrid);

            }

            printJob.send();

            Application.application.addChild(printGrid);

            printGrid.width = printJob.pageWidth;

            printGrid.height = printJob.pageHeight;

             

            {

             

             

            {

             

            lblDataProvider.visible = false;

            printJob.addObject(printGrid);

             

            lblDataProvider.visible = true;

            Application.application.removeChild(printGrid);

            }

            }

             

            Thanks,

            Bhasker Chari

             

            • 3. Re: print datagrid?
              miguel8312 Level 3

              well im trying to print the dataprovider of a list container. therefore on this line fo code

               

              printGrid.dataProvider = ld.dataProvider;

               

              i padd the provider of that component to the grid.

              right at the top of my grid when i print. i get the arraycolllections label  which to the end user does not mean anything.

              so i would like to either just print the list or modify the label printing on the list.

              I really appreciate your help on this.

              miguel

              • 4. Re: print datagrid?
                miguel8312 Level 3

                I'm an idiot when i posted my code it looks like is missing somethings from my code.

                here is the code im actually using.

                 

                public
                
                
                 function print():void
                               {
                
                var printJob:FlexPrintJob = new FlexPrintJob();
                
                
                if (printJob.start())
                                    {
                
                
                var printGrid:PrintDataGrid = new PrintDataGrid();                         printGrid.width = printJob.pageWidth;
                                         printGrid.height = printJob.pageHeight;
                
                
                //printGrid.columns = populationGrid.columnCount;
                                         printGrid.dataProvider = ld.dataProvider;
                                         printGrid.visible = 
                false;                         Application.application.addChild(printGrid);
                                         printJob.addObject(printGrid);
                
                
                while (printGrid.validNextPage)
                                         {
                                              printGrid.nextPage();
                                              printJob.addObject(printGrid);
                                         }
                                         printJob.send();
                                         Application.application.removeChild(printGrid);
                                    }
                               }
                
                
                
                
                
                • 5. Re: print datagrid?
                  miguel8312 Level 3

                  here is a picture of what im trying to change to a different name.  I like to take the fwvitals_messageD wich is the name of the array collection and name it something else. but i dont want to change the name of my array collection.1.jpg

                  • 6. Re: print datagrid?
                    miguel8312 Level 3

                    can anyone throw me a bone here?

                    • 7. Re: print datagrid?
                      miguel8312 Level 3

                      hope this helps someone else someday. the trick to not showing the label header on the printdatagrid.

                      is below. god what a simple line of code and what a nightmare.

                       

                       

                      showHeaders="false"