1 16 17 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements; 18 19 import org.apache.commons.lang.StringUtils; 20 import org.apache.poi.hssf.usermodel.HSSFPrintSetup; 21 22 import java.io.IOException ; 23 24 35 public class EP_Paper extends BaseElementProcessor { 36 37 private String _paper; 38 39 42 public EP_Paper() { 43 super(null); 44 } 45 46 public String getPaper(){ 47 if (_paper == null) { 48 _paper = StringUtils.strip(this.getData()); 49 } 50 return this._paper; 51 } 52 53 58 59 public void endProcessing() throws IOException { 60 _paper = getPaper(); 61 Sheet sheet = this.getSheet(); 62 short paperSize = HSSFPrintSetup.LETTER_PAPERSIZE; 63 if (StringUtils.isNotEmpty(_paper)) { 64 if ("A4".equalsIgnoreCase(_paper)) { 65 paperSize = HSSFPrintSetup.A4_PAPERSIZE; 66 } else if ("A5".equalsIgnoreCase(_paper)) { 67 paperSize = HSSFPrintSetup.A5_PAPERSIZE; 68 } else if ("Legal".equalsIgnoreCase(_paper)) { 69 paperSize = HSSFPrintSetup.LEGAL_PAPERSIZE; 70 } else if ("Executive".equalsIgnoreCase(_paper)) { 71 paperSize = HSSFPrintSetup.EXECUTIVE_PAPERSIZE; 72 } 73 } 74 sheet.setPaperSize(paperSize); 75 } 76 77 } | Popular Tags |