Java Code Examples for org.apache.poi.hssf.usermodel.HSSFPrintSetup#setFooterMargin()
The following examples show how to use
org.apache.poi.hssf.usermodel.HSSFPrintSetup#setFooterMargin() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JRXlsMetadataExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
private void updateHeaderFooterMargin(Integer marginValue, boolean isHeaderMargin) { if(marginValue != null) { HSSFPrintSetup printSetup = sheet.getPrintSetup(); double margin = LengthUtil.inch(marginValue); if(isHeaderMargin) { if(margin > printSetup.getHeaderMargin()) { printSetup.setHeaderMargin(margin); } } else { if(margin > printSetup.getFooterMargin()) { printSetup.setFooterMargin(margin); } } } }
Example 2
Source File: ExportEventsImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private HSSFSheet createSheet ( final List<Event> events, final HSSFWorkbook workbook, final List<Field> columns ) { final HSSFSheet sheet = workbook.createSheet ( Messages.ExportImpl_ExcelSheet_Name ); final HSSFHeader header = sheet.getHeader (); header.setLeft ( Messages.ExportImpl_ExcelSheet_Header ); header.setRight ( HeaderFooter.date () + " " + HeaderFooter.time () );//$NON-NLS-1$ final HSSFFooter footer = sheet.getFooter (); footer.setLeft ( String.format ( Messages.ExportImpl_ExcelSheet_Footer_1, events.size () ) ); footer.setRight ( Messages.ExportImpl_ExcelSheet_Footer_2 + HeaderFooter.page () + Messages.ExportImpl_ExcelSheet_Footer_3 + HeaderFooter.numPages () ); makeHeader ( columns, sheet ); final HSSFPrintSetup printSetup = sheet.getPrintSetup (); printSetup.setLandscape ( true ); printSetup.setFitWidth ( (short)1 ); printSetup.setFitHeight ( (short)0 ); printSetup.setPaperSize ( PrintSetup.A4_PAPERSIZE ); sheet.setAutoFilter ( new CellRangeAddress ( 0, 0, 0, columns.size () - 1 ) ); sheet.createFreezePane ( 0, 1 ); sheet.setFitToPage ( true ); sheet.setAutobreaks ( true ); printSetup.setFooterMargin ( 0.25 ); sheet.setMargin ( Sheet.LeftMargin, 0.25 ); sheet.setMargin ( Sheet.RightMargin, 0.25 ); sheet.setMargin ( Sheet.TopMargin, 0.25 ); sheet.setMargin ( Sheet.BottomMargin, 0.5 ); return sheet; }