javaibm-midrangerpglehssf

SetMargin in RPGLE on iSeries (HSSF Scott Klement Java)


i use the HSSF Excel-Tool from Scott Klement on iSeries.

I try to setup the Margins on my Excelfile to Print my Excel with smaller margins. But the margin methods aren't in the Scott Klement HSSF as an RPGLE Prototype.

My Question: How can i use the setMargin Method in RPGLE? How do I have to write the prototype in HSSF to use it on my RPGLE-Code?

Here the Java-Code that i need for my RPG:

    sheet.setMargin ( Sheet.LeftMargin, 0.25 );
    sheet.setMargin ( Sheet.RightMargin, 0.25 );
    sheet.setMargin ( Sheet.TopMargin, 0.25 );
    sheet.setMargin ( Sheet.BottomMargin, 0.5 );

Here for example the running RPG Code for setting the page in Landscape

PrintOptions = SSSheet_getPrintSetup(sheet);   
SSPrintSetup_setLandscape(PrintOptions: *ON);  

Prototype in HSSF:

D SSSheet_getPrintSetup...                                        
D                 PR                  like(SSPrintSetup)          
D                                     extproc(*JAVA               
D                                     : SHEET_CLASS               
D                                     : 'getPrintSetup')          

D SSPrintSetup_setLandscape...                                       
D                 PR                  extproc(*JAVA                  
D                                     : PRINTSETUP_CLASS             
D                                     : 'setLandscape')              
D   setting                      1N   value                          


Solution

  • You'd need to look at the Java interface

    public void setMargin(short margin,
                          double size)
    

    And build the RPG prototype, something like so: (My Java is a bit rusty)

    dcl-c LEFT_MARGIN   const(0);
    dcl-c RIGHT_MARGIN  const(1);
    dcl-c TOP_MARGIN    const(2);
    dcl-c BOTTOM_MARGIN const(3);
    
    dcl-pr SSSheet_setMargin extproc(*JAVA: SHEET_CLASS: 'setMargin');
      margin like(jshort) value;
      size   like(jdouble) value;
    end-pr;
    

    Now you can call it

    SSSheet_setMargin(LEFT_MARGIN:0.25);