1 16 17 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements; 18 19 import org.apache.poi.hssf.util.RangeAddress; 20 import org.apache.poi.hssf.util.Region; 21 22 import java.io.IOException ; 23 24 31 public class EPMerge extends BaseElementProcessor { 32 33 private String _cellRange; 34 35 38 public EPMerge() { 39 super(null); 40 _cellRange = null; 41 } 42 43 public String getCellRange() { 44 if (this._cellRange == null) { 45 _cellRange = this.getData(); 47 } 48 return this._cellRange; 49 } 50 51 55 public void endProcessing() throws IOException { 56 RangeAddress rangeAddress = new RangeAddress(getCellRange()); 57 Sheet sheet = this.getSheet(); 58 59 short fromCol = 62 (short) (rangeAddress.getXPosition(rangeAddress.getFromCell()) - 1); 63 int fromRow = rangeAddress.getYPosition(rangeAddress.getFromCell()) - 1; 64 short toCol = 65 (short) (rangeAddress.getXPosition(rangeAddress.getToCell()) - 1); 66 int toRow = rangeAddress.getYPosition(rangeAddress.getToCell()) - 1; 67 68 if (getLogger().isDebugEnabled()) { 69 getLogger().debug("Merging Range: Row (" + fromRow + ") Col (" 70 + fromCol + ")" + " to Row (" + toRow + ") Col (" + toCol 71 + ")"); 72 } 73 Region region = new Region(fromRow, fromCol, toRow, toCol); 74 sheet.addMergedRegion(region); 75 } 76 77 } | Popular Tags |