I am using sap OLE concept to convert it into excel.. I have use page set up option, But i need to chage the orientation to landscape and change the margin sizes but i am not able to do that with the coding ? to change in this follwing code can any one help to proceed further
CALL METHOD OF h_excel 'ACTIVESHEET' = activesheet.
GET PROPERTY OF activesheet 'PageSetup' = pagesetup.
SET PROPERTY OF pagesetup 'Zoom' = 65.
Hello,
Try this for Landscape (all ole objects are of type OLE2_OBJECT)
CREATE OBJECT EXCEL 'EXCEL.APPLICATION'. IF SY-SUBRC NE 0. WRITE: / 'No EXCEL creation possible'. STOP. ENDIF. SET PROPERTY OF EXCEL 'DisplayAlerts' = 0. CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOK . SET PROPERTY OF EXCEL 'VISIBLE' = 1. * creating workbook SET PROPERTY OF EXCEL 'SheetsInNewWorkbook' = 1. CALL METHOD OF WORKBOOK 'ADD'. CALL METHOD OF EXCEL 'WORKSHEETS' = SHEET. CALL METHOD OF SHEET 'ADD'. FREE OBJECT SHEET. CALL METHOD OF EXCEL 'WORKSHEETS' = SHEET EXPORTING #1 = 1. GET PROPERTY OF sheet 'PageSetup' = h_pagesetup. set PROPERTY OF h_pagesetup 'Orientation' = 2.
Margin sizes are in points, All are attributes of H_PAGESETUP
eg:
SET PROPERTY OF h_pagesetup 'LeftMargin' = 140.
Other properties include
RightMargin
TopMargin
BottomMargin
HeaderMargin
FooterMargin
Zoom (in percentage)
Add a comment