In DsExcel Java, you can use the methods of the IPageSetup interface in order to configure page settings.
Configuring page settings involves the following tasks:
You can use the setTopMargin method, setHeaderMargin method, setFooterMargin method, setRightMargin method, setLeftMargin method and the setBottomMargin method of the IPageSetup interface to configure margins for a page.
Java |
Copy Code |
---|---|
// Set margins, in points.
worksheet.getPageSetup().setTopMargin(36);
worksheet.getPageSetup().setBottomMargin(36);
worksheet.getPageSetup().setLeftMargin(28.8);
worksheet.getPageSetup().setRightMargin(72);
worksheet.getPageSetup().setHeaderMargin(0);
worksheet.getPageSetup().setFooterMargin(93.6); |
You can use the setOrientation method of the IPageSetup interface in order to set the orientation for a page to Portrait or Landscape as per custom preferences.
Java |
Copy Code |
---|---|
// Set page orientation, default is portrait.
worksheet.getPageSetup().setOrientation(PageOrientation.Landscape); |
You can use the setOrder method of the IPageSetup interface in order to configure the order of the page as per your choice.
Java |
Copy Code |
---|---|
// Set page order. The default value is DownThenOver.
worksheet.getPageSetup().setOrder(Order.OverThenDown); |
You can use the setCenterHorizontally method and the setCenterVertically method of the IPageSetup interface in order to configure the center of the page according to your custom preferences.
Java |
Copy Code |
---|---|
// Set page center. The default value is false. worksheet.getPageSetup().setCenterHorizontally(true); worksheet.getPageSetup().setCenterVertically(true); |
You can use the setFirstPageNumber method of the IPageSetup interface in order to configure the number for your first page as per your choice.
Java |
Copy Code |
---|---|
// Set first page number, default is p1.
worksheet.getPageSetup().setFirstPageNumber(3); |
You can also use setIsAutoFirstPageNumber method of the IPageSetup interface to set the first page number to ¡°Auto¡±.
Java |
Copy Code |
---|---|
// Set first page number to Auto. worksheet.getPageSetup().setIsAutoFirstPageNumber(true); |