como EXPORTO a Excel usando PRINTER.PRG?

como EXPORTO a Excel usando PRINTER.PRG?

Postby karinha » Thu Dec 08, 2022 6:02 pm

Buenas tardes señores, como EXPORTO a Excel usando PRINTER.PRG? Usando REPORT, funciona bien, pero con PRINTER.PRG incluso si apago WHEN() del Botón Exportar de la clase RPREVIEW.PRG, no funciona.


Code: Select all  Expand view

      DEFINE TBBUTTON OF oBar ;
         ACTION  ::ExportToMSExcel() ;
         TOOLTIP FWString( "Export to Excel" ) ;
         MESSAGE FWString( "Export to Excel" ) /* ;
         WHEN ::CanExportToExcel */


         DEFINE BUTTON oBtn OF oBar ;
            MESSAGE FWString( "Export to Excel" ) ;
            ACTION ::ExportToMSExcel() ;
            TOOLTIP FWString( "Export to Excel" ) /* ;
            WHEN ::CanExportToExcel */

 


Imagen:

https://imgur.com/5ioRsJc

Image

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7342
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: como EXPORTO a Excel usando PRINTER.PRG?

Postby nageswaragunupudi » Fri Dec 09, 2022 6:43 pm

Because TReport deals with tables, it knows to export the contents of the table to Excel and has a built in ToExcel method. When the user clicks Excel button, this method is invoked.

In case of TPrinter, programmer can print anything anywhere on the page. Printer class does not know how to export to excel.
If the data is suital

Unlike TReport, TPrinter can not export to excel by itself. In suitable cases, programmer can write his own function and assign it oPrn:bToExcel.
Eg
Code: Select all  Expand view

oPrn:bToExcel := { |oPreview| MyExportToExcel( oPreview ) }
 

In such cases, preview enables the excel button and oPrn:bExcel is executed.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10308
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: como EXPORTO a Excel usando PRINTER.PRG?

Postby karinha » Fri Dec 09, 2022 9:33 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7342
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests