oribeiro Posted August 29, 2019 Report Share Posted August 29, 2019 Pessoal, Com o comando "REPORT oRpt" funciona muito bem a exportação para o EXCEL. Alguém já descobriu um modo do RPreview exportar para o Excel os relatórios gerados com o comando "PRINT oPrn" ? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 29, 2019 Report Share Posted August 29, 2019 ??? Vc. quer dizer, usando a PRINTER.PRG?? Quote Link to comment Share on other sites More sharing options...
oribeiro Posted August 29, 2019 Author Report Share Posted August 29, 2019 Bom dia João, Sim. Quando eu visualizo um relatório feito com PRINTER.PRG no RPreview.prg ele não me dá a opção de exportar para o Excel como ele faz com os relatórios gerados com o REPORT.PRG. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 29, 2019 Report Share Posted August 29, 2019 Mira aqui, se te serve: http://forums.fivetechsupport.com/viewtopic.php?f=6&t=14489&p=74884&hilit=EXCEL+CON+PRINTER#p74884 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 29, 2019 Report Share Posted August 29, 2019 fwh\samples\prn2excel.prg http://forums.fivetechsupport.com/viewtopic.php?f=6&t=34768&p=206763&hilit=boton+excel#p206763 Quote Link to comment Share on other sites More sharing options...
oribeiro Posted August 29, 2019 Author Report Share Posted August 29, 2019 João, No exemplo citado no link eles criam uma função que exporta para o excel o conteúdo de uma matriz mas não faz a exportação do excel dos dados que estão no relatório como ele faz automaticamente com o REPORT.PRG. O exemplo que eles usam é esse: #include "fivewin.ch" //----------------------------------------------------------------------------// function Main() local oPrn, oFont, n, nRow local aData := { ; { "One", "Two", "Three" }, ; { "Four", "Five", "Six" }, ; { "Seven", "Eight", "Nine" }, ; { "Ten", "Eleven", "Twelve" } } PRINT oPrn PREVIEW DEFINE FONT oFont NAME "ARIAL" SIZE 0,-15 OF oPrn oPrn:bToExcel := { || ToExcel( aData ) } PAGE n := 1 nRow := 1000 do while n <= Len( aData ) @ nRow, 1000 PRINT TO oPrn TEXT aData[ n, 1 ] FONT oFont @ nRow, 2000 PRINT TO oPrn TEXT aData[ n, 2 ] FONT oFont @ nRow, 3000 PRINT TO oPrn TEXT aData[ n, 3 ] FONT oFont nRow += 200 n++ enddo ENDPAGE ENDPRINT RELEASE FONT oFont return nil //----------------------------------------------------------------------------// static function ToExcel( aData ) local oExcel := ExcelObj() local oBook := oExcel:WorkBooks:Add() local oSheet := oBook:ActiveSheet local oRange, n oExcel:ScreenUpdating := .f. oRange := oSheet:Range( oSheet:Columns( 1 ), oSheet:Columns( 3 ) ) for n := 1 to Len( aData ) oRange:Rows( n ):Value := aData[ n ] next oExcel:ScreenUpdating := .t. oExcel:Visible := .t. ShowWindow( oExcel:hWnd, 3 ) return nil //----------------------------------------------------------------------------// Quote Link to comment Share on other sites More sharing options...
kapiaba Posted August 29, 2019 Report Share Posted August 29, 2019 Para EXCEL, somente usando RPREVIEW.PRG, veja se consegue modificar a RPREVIEW.PRG, acho dificil. Quote Link to comment Share on other sites More sharing options...
oribeiro Posted August 29, 2019 Author Report Share Posted August 29, 2019 Notel que a classe REPORT.PRG tem um METHOD ToExcel() e o PRINTER.PRG não tem. Pelo visto ainda não implementaram essa função na classe PRINTER.PRG. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.