Jump to content
Fivewin Brasil

Printer / RPreviwe


Theotokos

Recommended Posts

Exemplo simples: Eu acho... kkkkkkkkk

	#include "fivewin.ch"
#include "report.ch"

function Main()

   local oRep, oFont, oBold, oCol

   USE STATES NEW SHARED
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA"  SIZE 0,-12
   REPORT oRep PREVIEW FONT oFont

   COLUMN oCol TITLE "CODE" DATA FIELD->CODE
   COLUMN oCol TITLE "NAME" DATA FIELD->NAME

   ENDREPORT

   oRep:bInit := { || STATES->( DBGOTOP() ) }

   ACTIVATE REPORT oRep
   RELEASE FONT oFont
   STATES->( DBCLOSEAREA() ) // or simpler CLOSE STATES

return nil 
	

 

Regards, saludos.

Link to comment
Share on other sites

Pronto!

Exemplo by Mister Nages:

// C:\FWH..\SAMPLES\EXCELPRV.PRG - EXCEL NO PREVIEW.
	#Include "FiveWin.ch"
	FUNCTION Main()
	   LOCAL oPrn, oFont, nRow, nCol
	   USE STATES NEW SHARED
	   STATES->( StatesReport() )
	   CLOSE STATES
	RETURN NIL
	STATIC FUNCTION StatesReport()
	   LOCAL oPrn, oFont, nRow
	   GO TOP
	   PRINT oPrn PREVIEW
	   // AQUI LIGA O EXCEL.
   oPrn:bToExcel  := {|| ( Alias() )->( StatesToExcel() ) }
	   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 10 OF oPrn
	   PAGE
	   nRow  := 1
	   WHILE .NOT. Eof()
	      SYSREFRESH()
	      @ nRow, 5.0 PRINT TO oPrn TEXT FIELD->CODE SIZE  1, 0.4 CM FONT oFont
	      @ nRow, 6.0 PRINT TO oPrn TEXT FIELD->NAME SIZE 10, 0.4 CM FONT oFont
	      nRow  += 0.5
	      SKIP
	   ENDDO
	   ENDPAGE
	   ENDPRINT
	   RELEASE FONT oFont
	   GO TOP
	RETURN NIL
	STATIC FUNCTION StatesToExcel()
	   LOCAL oExcel, oBook, oSheet, nRow
	   oExcel   := ExcelObj()
   oExcel:ScreenUpdating := .F.
   oBook    := oExcel:WorkBooks:Add()
   oSheet   := oExcel:ActiveSheet
	   GO TOP
	   nRow  := 1
	   WHILE .NOT. Eof()
	      SYSREFRESH()
	      oSheet:Cells( nRow, 1 ):Value := FIELD->CODE
	      oSheet:Cells( nRow, 2 ):Value := FIELD->NAME
	      nRow++
	      SKIP
	   ENDDO
	   GO TOP
	   oSheet:Columns( 1 ):AutoFit()
   oSheet:Columns( 2 ):AutoFit()
	   oExcel:ScreenUpdating := .T.
   oExcel:Visible := .T.
	RETURN NIL
	// FIN / END

Regards, saludos.

Link to comment
Share on other sites

Em tempo: este comando para ligar o EXCEL no PREVIEW, é a partir da versão FWH13.07 ou FWH17.11, ok?

Veja também , esse BUG na REPORT.PRG, veja se já corrigiram na sua versão:

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=40087&p=239200&hilit=bToExcel&sid=6392a89c1246f14ea6c3461cb6f1566e#p239200

Origem:

http://forums.fivetechsupport.com/viewtopic.php?f=3&t=39065&p=233006&hilit=bToExcel&sid=6392a89c1246f14ea6c3461cb6f1566e#p233006

Regards, saludos.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...