kalau hanya untuk kebutuhan export kr excel, pdf, html, word pakai : FoxyPreviewer adja bos, bisa download disini :
http://www.foxypreviewer.com/p/downloads.htmlatau bisa pakai : frx2any tapi bayar tidak gratis hehehehe
tapi kalau masih butuh FJLISTENER.prg ini sourcecodenya :
* Tell VFP that we’ll be using the new report features
SET REPORTBEHAVIOR 90
LOCAL loReportListener
loReportListener = CREATEOBJECT(“FullJustifyListener”)
loReportListener.ListenerType = 1
REPORT FORM YourReport OBJECT loReportListener
* Program : FJLISTENER.PRG
* Version : 2.0
* Purpose : Provides a Report Listener that allows rendering text in
* Full Justify alignment.
* Authors : Cesar Ch
http://weblogs.foxite.com/vfpimaging* Class based on article “Listening to a report” by Doug Hennig
* New tweaked version allows drawing strings that need to be divided in more than one page
* Special thanks to Victor Espinoza
*
http://msdn2.microsoft.com/en-us/library/ms947682.aspxDEFINE CLASS FullJustifyListener AS _ReportListener OF HOME() + ‘FFC\_ReportListener.VCX’
oGDIGraphics = NULL
nSaveGraphicsHandle = 0
nTimes = 1
DIMENSION aRecords[1]
* Before we run the report, go through the FRX and store information about any
* field with our expected directive in its USER memo into the aRecords array.
FUNCTION BEFOREREPORT
DODEFAULT()
* Check if we already have the “System” object in “_Screen”
IF NOT PEMSTATUS(_Screen,”System”,5)
DO LOCFILE(“System.App”)
ENDIF
WITH This
.oGDIGraphics = _SCREEN.SYSTEM.Drawing.Graphics.New()
.SetFRXDataSession()
DIMENSION .aRecords[reccount(), 13]
SCAN FOR “” $ UPPER(User)
.aRecords[recno(), 13] = “FJ”
ENDSCAN
.ResetDataSession()
ENDWITH
ENDFUNC
FUNCTION BEFOREBAND(nBandObjCode, nFRXRecNo)
This.SharedGDIPlusGraphics = This.GDIPLUSGRAPHICS
This.oGDIGraphics.Handle = This.SharedGDIPlusGraphics
DODEFAULT(nBandObjCode, nFRXRecNo)
ENDFUNC
PROCEDURE RENDER(tnFRXRecNo,;
tnLeft,tnTop,tnWidth,tnHeight,;
nObjectContinuationType, ;
cContentsToBeRendered, GDIPlusImage)
LOCAL lcText, llFlag
llFlag = .F.
lcText = This.aRecords(tnFRXRecNo,1)
IF (VARTYPE(lcText) = “C” AND LEFT(lcText,4) = “”) OR ;
(VARTYPE(This.aRecords(tnFRXRecNo,13)) = “C” AND This.aRecords(tnFRXRecNo,13) == “FJ”)
IF nObjectContinuationType > 0
* nObjectContinuationType
* ———————–
* Indicates the current continuation state for the rendered element. When layout elements span pages, they are rendered in multiple sections (once for each page).
* Value Continuation Type
* 0 Complete (no continuation).
* 1 Start of layout element occurrence, will not finish on the current page.
* 2 Mid-element, neither started nor finished on the current page.
* 3 End of element, completed on the current page.
* cContentsToBeRendered
* ———————
* Indicates the text to be rendered for Expression (Field) and Label layout elements.
* If your derived class sends the text value through some additional processing, such as storage in a table, you can use the STRCONV() function, and its optional regional script parameter, to convert the string to DBCS first. For more information, see STRCONV( ) Function.
lcText = STRCONV(cContentsToBeRendered,6)
IF INLIST(nObjectContinuationType, 1, 2)
llFlag = .T.
ENDIF
ENDIF
IF UPPER(LEFT(lcText,4)) = “”
lcText = SUBSTR(lcText,5) && Remove the tag from string
ENDIF
WITH _SCREEN.SYSTEM.Drawing
This.oGDIGraphics.Handle = This.GDIPlusGraphics
*!* Create a GDI+ Rectangle which specifies where on the
*!* surface we’re drawing the text.
LOCAL loRectF as xfcRectangleF
loRectF = .RectangleF.New(tnLeft, tnTop, tnWidth, tnHeight)
LOCAL loFont as xfcFont
loFont = .Font.New(This.aRecords(tnFRXRecNo,2) ;
, This.aRecords(tnFRXRecNo,4), This.aRecords(tnFRXRecNo,3) ;
, .GraphicsUnit.Point)
* Retrieve colors for the background
LOCAL lnRed, lnGreen, lnBlue, lnAlpha
lnRed = This.aRecords[tnFRXRecno,5]
lnGreen = This.aRecords[tnFRXRecno,6]
lnBlue = This.aRecords[tnFRXRecno,7]
lnAlpha = This.aRecords[tnFRXRecno,8]
LOCAL loBackBrush as xfcSolidBrush
loBackBrush = .SolidBrush.New(;
.Color.FromArgb(lnAlpha,lnRed, lnGreen, lnBlue))
This.oGdiGraphics.FillRectangle(loBackBrush, tnLeft, tnTop, tnWidth, tnHeight)
* Retieve colors for the Text
lnRed = This.aRecords[tnFRXRecno,9]
lnGreen = This.aRecords[tnFRXRecno,10]
lnBlue = This.aRecords[tnFRXRecno,11]
lnAlpha = This.aRecords[tnFRXRecno,12]
LOCAL loTextBrush as xfcSolidBrush
loTextBrush = .SolidBrush.New(;
.Color.FromArgb(lnAlpha,lnRed, lnGreen, lnBlue))
This.oGdiGraphics.DrawStringJustified(lcText, loFont, loTextBrush, loRectF, llFlag)
ENDWITH
ELSE
*!* If we’re not drawing a full justified string,
*!* let Fox draw the text as usual.
DODEFAULT(tnFRXRecNo, tnLeft, tnTop, tnWidth, tnHeight, ;
nObjectContinuationType, cContentsToBeRendered, GDIPlusImage)
ENDIF
*!* Since we already drew the text, we don’t want the default
*!* behavior to occur.
NODEFAULT
ENDPROC
FUNCTION EvaluateContents(tnFRXRecno, toObjProperties)
* Get the FRX data
This.aRecords[tnFRXRecno,1] = toObjProperties.Text
This.aRecords[tnFRXRecno,2] = toObjProperties.FontName
This.aRecords[tnFRXRecno,3] = toObjProperties.FontStyle
This.aRecords[tnFRXRecno,4] = toObjProperties.FontSize
This.aRecords[tnFRXRecno,5] = toObjProperties.FillRed
This.aRecords[tnFRXRecno,6] = toObjProperties.FillGreen
This.aRecords[tnFRXRecno,7] = toObjProperties.FillBlue
This.aRecords[tnFRXRecno,8] = toObjProperties.FillAlpha
This.aRecords[tnFRXRecno,9] = toObjProperties.PenRed
This.aRecords[tnFRXRecno,10] = toObjProperties.PenGreen
This.aRecords[tnFRXRecno,11] = toObjProperties.PenBlue
This.aRecords[tnFRXRecno,12] = toObjProperties.PenAlpha
ENDFUNC
ENDDEFINE