Hi Everybody,
Does anyone know how to force a "Page Break" in Excel via FW ?
Thanks,
Jeff
#define xlPageBreakManual -4135
#define xlPageBreakNone -4142
FUNCTION MAIN()
LOCAL oExcel := CREATEOBJECT( "Excel.Application" )
LOCAL oSheet
oExcel:WorkBooks:Add()
oSheet = oExcel:ActiveSheet
oSheet:Cells( 1, 1 ):Value = "This is the first page"
oSheet:Rows( 2 ):PageBreak = xlPageBreakManual
oSheet:Cells( 2, 1 ):Value = "This is the second page"
oExcel:Visible = .T.
RETURN NIL
FUNCTION MAIN()
LOCAL oExcel := CREATEOBJECT( "Excel.Application" )
LOCAL oSheet
oExcel:WorkBooks:Add()
oSheet = oExcel:ActiveSheet
oExcel:ActiveWindow:View := 2
// View = 2 sets excel to page break preview mode.
oSheet:ResetAllPageBreaks()
nTotalBreaks := oSheet:HPageBreaks:Count()
for nCounter := 1 to nTotalBreaks
oPageBreak := oSheet:HPageBreaks[nCounter] // This Works
do case
case nCounter = 1
cCells := 'A'+alltrim(str(nMyFirstBreak))
case nCounter = 2
cCells := 'A'+alltrim(str(nMySecondBreak))
endcase
oPageBreak:location := oSheet:Range( cCells )
next
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 82 guests