net.sf.jxls.util
Class Util
java.lang.Object
net.sf.jxls.util.Util
public final class Util
- extends java.lang.Object
This class contains many utility methods used by jXLS framework
- Author:
- Leonid Vysochyn, Vincent Dutat
|
Constructor Summary |
Util()
|
|
Method Summary |
static boolean |
areRegionsEqual(org.apache.poi.ss.util.CellRangeAddress region1,
org.apache.poi.ss.util.CellRangeAddress region2)
|
static java.lang.String |
buildCommaSeparatedListOfCells(java.lang.String refSheetName,
java.util.List cells)
|
static void |
copyCell(org.apache.poi.hssf.usermodel.HSSFCell oldCell,
org.apache.poi.hssf.usermodel.HSSFCell newCell,
boolean copyStyle)
|
static void |
copyCell(org.apache.poi.hssf.usermodel.HSSFCell oldCell,
org.apache.poi.hssf.usermodel.HSSFCell newCell,
boolean copyStyle,
java.lang.String expressionToReplace,
java.lang.String expressionReplacement)
|
static void |
copyPageSetup(org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFSheet srcSheet)
|
static void |
copyPrintSetup(org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFSheet srcSheet)
|
static void |
copyRow(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
org.apache.poi.hssf.usermodel.HSSFRow oldRow,
org.apache.poi.hssf.usermodel.HSSFRow newRow)
|
static void |
copyRow(org.apache.poi.hssf.usermodel.HSSFSheet srcSheet,
org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFRow srcRow,
org.apache.poi.hssf.usermodel.HSSFRow destRow)
|
static void |
copyRow(org.apache.poi.hssf.usermodel.HSSFSheet srcSheet,
org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFRow srcRow,
org.apache.poi.hssf.usermodel.HSSFRow destRow,
java.lang.String expressionToReplace,
java.lang.String expressionReplacement)
|
static void |
copySheets(org.apache.poi.hssf.usermodel.HSSFSheet newSheet,
org.apache.poi.hssf.usermodel.HSSFSheet sheet)
|
static void |
copySheets(org.apache.poi.hssf.usermodel.HSSFSheet newSheet,
org.apache.poi.hssf.usermodel.HSSFSheet sheet,
java.lang.String expressionToReplace,
java.lang.String expressionReplacement)
|
static java.lang.String |
detectCellRange(java.lang.String refSheetName,
java.util.List cells)
|
static int |
duplicateRow(RowCollection rowCollection)
|
static void |
duplicateRowCollectionProperty(RowCollection rowCollection)
|
static org.apache.poi.hssf.usermodel.HSSFCellStyle |
duplicateStyle(org.apache.poi.hssf.usermodel.HSSFWorkbook workbook,
org.apache.poi.hssf.usermodel.HSSFCellStyle style)
Duplicates given HSSFCellStyle object |
static java.lang.String |
escapeAttributes(java.lang.String tag)
|
static org.apache.poi.ss.util.CellRangeAddress |
getMergedRegion(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int rowNum,
int cellNum)
|
static java.lang.Object |
getProperty(java.lang.Object bean,
java.lang.String propertyName)
|
static java.lang.String |
getRefCellName(java.lang.String refSheetName,
java.lang.String cellName)
|
static boolean |
isColumnRange(java.util.List cells)
|
protected static boolean |
isNewMergedRegion(org.apache.poi.ss.util.CellRangeAddress region,
java.util.Collection mergedRegions)
|
static boolean |
isRangeContainsCell(org.apache.poi.ss.util.CellRangeAddress range,
int row,
int col)
|
static boolean |
isRowRange(java.util.List cells)
|
static void |
prepareCollectionPropertyInRowForContentDuplication(RowCollection rowCollection)
|
static void |
prepareCollectionPropertyInRowForDuplication(RowCollection rowCollection,
java.lang.String collectionItemName)
|
static void |
removeMergedRegion(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
org.apache.poi.ss.util.CellRangeAddress region)
Removes merged region from sheet |
static boolean |
removeMergedRegion(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int rowNum,
int cellNum)
|
static void |
removeRowCollectionPropertiesFromRow(RowCollection rowCollection)
|
static void |
setPrintArea(org.apache.poi.hssf.usermodel.HSSFWorkbook resultWorkbook,
int sheetNum)
|
static void |
shiftCellsLeft(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int startRow,
int startCol,
int endRow,
int endCol,
int shiftNumber,
boolean removeSourceMergedRegion)
|
static void |
shiftCellsRight(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int startRow,
int endRow,
int startCol,
int shiftNumber,
boolean removeSourceMergedRegion)
|
static void |
shiftRows(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int startRow,
int endRow,
int shiftNum)
|
static void |
updateCellValue(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int rowNum,
int colNum,
java.lang.String cellValue)
|
protected static void |
updateMergedRegionInRow(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
java.util.Set mergedRegions,
int rowNum,
int cellNum,
int destCellNum,
boolean removeSourceMergedRegion)
|
static void |
writeToFile(java.lang.String fileName,
org.apache.poi.hssf.usermodel.HSSFWorkbook workbook)
Saves workbook to file |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static org.apache.commons.logging.Log log
regexCellRef
protected static final java.lang.String regexCellRef
- See Also:
- Constant Field Values
regexCellRefPattern
protected static final java.util.regex.Pattern regexCellRefPattern
regexCellCharPart
protected static final java.lang.String regexCellCharPart
- See Also:
- Constant Field Values
regexCellDigitPart
protected static final java.lang.String regexCellDigitPart
- See Also:
- Constant Field Values
cellRangeSeparator
protected static java.lang.String cellRangeSeparator
Util
public Util()
removeRowCollectionPropertiesFromRow
public static void removeRowCollectionPropertiesFromRow(RowCollection rowCollection)
removeMergedRegion
public static void removeMergedRegion(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
org.apache.poi.ss.util.CellRangeAddress region)
- Removes merged region from sheet
- Parameters:
sheet - region -
areRegionsEqual
public static boolean areRegionsEqual(org.apache.poi.ss.util.CellRangeAddress region1,
org.apache.poi.ss.util.CellRangeAddress region2)
isNewMergedRegion
protected static boolean isNewMergedRegion(org.apache.poi.ss.util.CellRangeAddress region,
java.util.Collection mergedRegions)
getMergedRegion
public static org.apache.poi.ss.util.CellRangeAddress getMergedRegion(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int rowNum,
int cellNum)
isRangeContainsCell
public static boolean isRangeContainsCell(org.apache.poi.ss.util.CellRangeAddress range,
int row,
int col)
removeMergedRegion
public static boolean removeMergedRegion(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int rowNum,
int cellNum)
prepareCollectionPropertyInRowForDuplication
public static void prepareCollectionPropertyInRowForDuplication(RowCollection rowCollection,
java.lang.String collectionItemName)
prepareCollectionPropertyInRowForContentDuplication
public static void prepareCollectionPropertyInRowForContentDuplication(RowCollection rowCollection)
duplicateRowCollectionProperty
public static void duplicateRowCollectionProperty(RowCollection rowCollection)
duplicateRow
public static int duplicateRow(RowCollection rowCollection)
copyRow
public static void copyRow(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
org.apache.poi.hssf.usermodel.HSSFRow oldRow,
org.apache.poi.hssf.usermodel.HSSFRow newRow)
copyRow
public static void copyRow(org.apache.poi.hssf.usermodel.HSSFSheet srcSheet,
org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFRow srcRow,
org.apache.poi.hssf.usermodel.HSSFRow destRow)
copyRow
public static void copyRow(org.apache.poi.hssf.usermodel.HSSFSheet srcSheet,
org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFRow srcRow,
org.apache.poi.hssf.usermodel.HSSFRow destRow,
java.lang.String expressionToReplace,
java.lang.String expressionReplacement)
copySheets
public static void copySheets(org.apache.poi.hssf.usermodel.HSSFSheet newSheet,
org.apache.poi.hssf.usermodel.HSSFSheet sheet)
copySheets
public static void copySheets(org.apache.poi.hssf.usermodel.HSSFSheet newSheet,
org.apache.poi.hssf.usermodel.HSSFSheet sheet,
java.lang.String expressionToReplace,
java.lang.String expressionReplacement)
copyCell
public static void copyCell(org.apache.poi.hssf.usermodel.HSSFCell oldCell,
org.apache.poi.hssf.usermodel.HSSFCell newCell,
boolean copyStyle)
copyCell
public static void copyCell(org.apache.poi.hssf.usermodel.HSSFCell oldCell,
org.apache.poi.hssf.usermodel.HSSFCell newCell,
boolean copyStyle,
java.lang.String expressionToReplace,
java.lang.String expressionReplacement)
getProperty
public static java.lang.Object getProperty(java.lang.Object bean,
java.lang.String propertyName)
writeToFile
public static void writeToFile(java.lang.String fileName,
org.apache.poi.hssf.usermodel.HSSFWorkbook workbook)
- Saves workbook to file
- Parameters:
fileName - - File name to save workbookworkbook - - Workbook to save
duplicateStyle
public static org.apache.poi.hssf.usermodel.HSSFCellStyle duplicateStyle(org.apache.poi.hssf.usermodel.HSSFWorkbook workbook,
org.apache.poi.hssf.usermodel.HSSFCellStyle style)
- Duplicates given HSSFCellStyle object
- Parameters:
workbook - - source HSSFWorkbook objectstyle - - HSSFCellStyle object to duplicate
- Returns:
- HSSFCellStyle
escapeAttributes
public static java.lang.String escapeAttributes(java.lang.String tag)
updateMergedRegionInRow
protected static void updateMergedRegionInRow(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
java.util.Set mergedRegions,
int rowNum,
int cellNum,
int destCellNum,
boolean removeSourceMergedRegion)
shiftCellsLeft
public static void shiftCellsLeft(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int startRow,
int startCol,
int endRow,
int endCol,
int shiftNumber,
boolean removeSourceMergedRegion)
shiftCellsRight
public static void shiftCellsRight(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int startRow,
int endRow,
int startCol,
int shiftNumber,
boolean removeSourceMergedRegion)
updateCellValue
public static void updateCellValue(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int rowNum,
int colNum,
java.lang.String cellValue)
copyPageSetup
public static void copyPageSetup(org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFSheet srcSheet)
copyPrintSetup
public static void copyPrintSetup(org.apache.poi.hssf.usermodel.HSSFSheet destSheet,
org.apache.poi.hssf.usermodel.HSSFSheet srcSheet)
setPrintArea
public static void setPrintArea(org.apache.poi.hssf.usermodel.HSSFWorkbook resultWorkbook,
int sheetNum)
isColumnRange
public static boolean isColumnRange(java.util.List cells)
isRowRange
public static boolean isRowRange(java.util.List cells)
buildCommaSeparatedListOfCells
public static java.lang.String buildCommaSeparatedListOfCells(java.lang.String refSheetName,
java.util.List cells)
detectCellRange
public static java.lang.String detectCellRange(java.lang.String refSheetName,
java.util.List cells)
getRefCellName
public static java.lang.String getRefCellName(java.lang.String refSheetName,
java.lang.String cellName)
shiftRows
public static void shiftRows(org.apache.poi.hssf.usermodel.HSSFSheet sheet,
int startRow,
int endRow,
int shiftNum)
Copyright © 2005-2010 jXLS Team. All Rights Reserved.