Documents for Excel, Java Edition Documentation
Features / Print Settings / Configure Paper Settings
In This Topic
    Configure Paper Settings
    In This Topic

    In GcExcel Java, you can use the methods of the IPageSetup interface in order to configure paper settings for customized printing.

    Configuring paper settings involves the following tasks:

    1. Configure Paper Scaling
    2. Configure Paper Size

    Configure Paper Scaling

    You can use the getIsPercentScale method in order to control how to the spreadsheet is scaled; the setIsPercentScale method, the setZoom method and the getPageSetup method in order to adjust the size of the paper that will be used for printing.

    Java
    Copy Code
    // Set paper scaling via percent scale
    worksheet.getPageSetup().setIsPercentScale(true);
            
    // Set paper scaling via zoom
    worksheet.getPageSetup().setZoom(150);
            
    // Set paper scaling via Fit to page's wide & tall
    worksheet.getPageSetup().setIsPercentScale(false);
    worksheet.getPageSetup().setFitToPagesWide(3);
    worksheet.getPageSetup().setFitToPagesTall(4);
    

    Configure Paper Size

    You can use the getPageSetup method and setPaperSize method in order to set the paper size for the paper that will be used for printing.

    Java
    Copy Code
    // Set built-in paper size. Default is Letter Format - A4
    worksheet.getPageSetup().setPaperSize(PaperSize.A4);