Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JSpreadsheet
>
Tutorial
> Set Page Size
The following example shows you how to set page size and orientation.
import com.independentsoft.office.spreadsheet.Cell; import com.independentsoft.office.spreadsheet.Orientation; import com.independentsoft.office.spreadsheet.PaperSize; import com.independentsoft.office.spreadsheet.Workbook; import com.independentsoft.office.spreadsheet.Worksheet; public class Example { public static void main(String[] args) { try { Worksheet sheet1 = new Worksheet(); sheet1.getPageSetupSettings().setPaperSize(PaperSize.A4_PAPER); sheet1.getPageSetupSettings().setOrientation(Orientation.PORTRAIT); sheet1.set("A1",new Cell(100)); Workbook book = new Workbook(); book.getSheets().add(sheet1); book.save("c:\\test\\output.xlsx", true); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*