本文整理汇总了Java中org.insightech.er.util.POIUtils类的典型用法代码示例。如果您正苦于以下问题:Java POIUtils类的具体用法?Java POIUtils怎么用?Java POIUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
POIUtils类属于org.insightech.er.util包,在下文中一共展示了POIUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
@Override
public void init(final ERDiagram diagram, final File projectDir) throws Exception {
super.init(diagram, projectDir);
excelFile = FileUtils.getFile(this.projectDir, exportExcelSetting.getExcelOutput());
excelFile.getParentFile().mkdirs();
// this.backup(this.excelFile, true);
InputStream templateStream = null;
try {
templateStream = getSelectedTemplate();
workbook = loadTemplateWorkbook(templateStream, this.diagram);
} finally {
if (templateStream != null) {
templateStream.close();
}
}
// check whether the file is not opened by another process.
POIUtils.writeExcelFile(excelFile, workbook);
}
示例2: doProcess
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
@Override
protected void doProcess(final ProgressMonitor monitor) throws Exception {
if (exportExcelSetting.isPutERDiagramOnExcel()) {
pictureSheetGenerator = createPictureSheetGenerator(monitor, workbook);
}
createSheetFromTemplate(monitor, workbook, diagram, exportExcelSetting.isUseLogicalNameAsSheet());
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
workbook.getSheetAt(i).setSelected(false);
}
if (workbook.getNumberOfSheets() > 0) {
workbook.getSheetAt(0).setSelected(true);
workbook.setActiveSheet(0);
workbook.setFirstVisibleTab(0);
}
POIUtils.writeExcelFile(excelFile, workbook);
}
示例3: setIndexMatrix
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
private void setIndexMatrix(final HSSFWorkbook workbook, final HSSFSheet sheet, final ERTable table) {
final CellLocation logicalIndexCellLocation = POIUtils.findCell(sheet, KEYWORD_LOGICAL_INDEX_MATRIX);
if (logicalIndexCellLocation != null) {
if (logicalIndexMatrixCellStyle == null) {
logicalIndexMatrixCellStyle = this.createMatrixCellStyle(workbook, sheet, logicalIndexCellLocation);
}
setIndexMatrix(workbook, sheet, table, logicalIndexCellLocation, logicalIndexMatrixCellStyle, true);
}
final CellLocation physicalIndexCellLocation = POIUtils.findCell(sheet, KEYWORD_PHYSICAL_INDEX_MATRIX);
if (physicalIndexCellLocation != null) {
if (physicalIndexMatrixCellStyle == null) {
physicalIndexMatrixCellStyle = this.createMatrixCellStyle(workbook, sheet, physicalIndexCellLocation);
}
setIndexMatrix(workbook, sheet, table, physicalIndexCellLocation, physicalIndexMatrixCellStyle, false);
}
}
示例4: setComplexUniqueKeyMatrix
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
private void setComplexUniqueKeyMatrix(final HSSFWorkbook workbook, final HSSFSheet sheet, final ERTable table) {
final CellLocation logicalCellLocation = POIUtils.findCell(sheet, KEYWORD_LOGICAL_COMPLEX_UNIQUE_KEY_MATRIX);
if (logicalCellLocation != null) {
if (logicalComplexUniqueKeyMatrixCellStyle == null) {
logicalComplexUniqueKeyMatrixCellStyle = this.createMatrixCellStyle(workbook, sheet, logicalCellLocation);
}
setComplexUniqueKeyMatrix(workbook, sheet, table, logicalCellLocation, logicalComplexUniqueKeyMatrixCellStyle, true);
}
final CellLocation physicalCellLocation = POIUtils.findCell(sheet, KEYWORD_PHYSICAL_COMPLEX_UNIQUE_KEY_MATRIX);
if (physicalCellLocation != null) {
if (physicalComplexUniqueKeyMatrixCellStyle == null) {
physicalComplexUniqueKeyMatrixCellStyle = this.createMatrixCellStyle(workbook, sheet, physicalCellLocation);
}
this.setComplexUniqueKeyMatrix(workbook, sheet, table, physicalCellLocation, physicalComplexUniqueKeyMatrixCellStyle, false);
}
}
示例5: createMatrixCellStyle
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
private HSSFCellStyle createMatrixCellStyle(final HSSFWorkbook workbook, final HSSFCellStyle matrixHeaderTemplateCellStyle, final boolean top, final boolean right, final boolean bottom, final boolean left) {
final HSSFCellStyle cellStyle = POIUtils.copyCellStyle(workbook, matrixHeaderTemplateCellStyle);
if (top) {
cellStyle.setBorderTop(CellStyle.BORDER_THIN);
}
if (right) {
cellStyle.setBorderRight(CellStyle.BORDER_THIN);
}
if (bottom) {
cellStyle.setBorderBottom(CellStyle.BORDER_THIN);
}
if (left) {
cellStyle.setBorderLeft(CellStyle.BORDER_THIN);
}
return cellStyle;
}
示例6: buildKeywordsValueMap
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
protected Map<String, String> buildKeywordsValueMap(final HSSFSheet wordsSheet, final int columnNo, final String[] keywords) {
final Map<String, String> keywordsValueMap = new HashMap<String, String>();
for (final String keyword : keywords) {
final CellLocation location = POIUtils.findCell(wordsSheet, keyword, columnNo);
if (location != null) {
final HSSFRow row = wordsSheet.getRow(location.r);
final HSSFCell cell = row.getCell(location.c + 2);
final String value = cell.getRichStringCellValue().getString();
if (value != null) {
keywordsValueMap.put(keyword, value);
}
}
}
return keywordsValueMap;
}
示例7: setImage
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
public void setImage(final HSSFWorkbook workbook, final HSSFSheet sheet) {
final CellLocation cellLocation = POIUtils.findMatchCell(sheet, "\\" + KEYWORD_ER + ".*");
if (cellLocation != null) {
int width = -1;
int height = -1;
final String value = POIUtils.getCellValue(sheet, cellLocation);
final int startIndex = value.indexOf("(");
if (startIndex != -1) {
final int middleIndex = value.indexOf(",", startIndex + 1);
if (middleIndex != -1) {
width = Integer.parseInt(value.substring(startIndex + 1, middleIndex).trim());
height = Integer.parseInt(value.substring(middleIndex + 1, value.length() - 1).trim());
}
}
this.setImage(workbook, sheet, cellLocation, width, height);
}
}
示例8: init
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
@Override
public void init(ERDiagram diagram, File projectDir) throws Exception {
super.init(diagram, projectDir);
this.excelFile = FileUtils.getFile(this.projectDir,
this.exportExcelSetting.getExcelOutput());
this.excelFile.getParentFile().mkdirs();
// this.backup(this.excelFile, true);
InputStream templateStream = null;
try {
templateStream = this.getSelectedTemplate();
workbook = this.loadTemplateWorkbook(templateStream, this.diagram);
} finally {
if (templateStream != null) {
templateStream.close();
}
}
// check whether the file is not opened by another process.
POIUtils.writeExcelFile(excelFile, workbook);
}
示例9: doProcess
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
@Override
protected void doProcess(ProgressMonitor monitor) throws Exception {
if (this.exportExcelSetting.isPutERDiagramOnExcel()) {
this.pictureSheetGenerator = this.createPictureSheetGenerator(
monitor, workbook);
}
this.createSheetFromTemplate(monitor, workbook, diagram,
this.exportExcelSetting.isUseLogicalNameAsSheet());
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
workbook.getSheetAt(i).setSelected(false);
}
if (workbook.getNumberOfSheets() > 0) {
workbook.getSheetAt(0).setSelected(true);
workbook.setActiveSheet(0);
workbook.setFirstVisibleTab(0);
}
POIUtils.writeExcelFile(excelFile, workbook);
}
示例10: setIndexMatrix
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
private void setIndexMatrix(HSSFWorkbook workbook, HSSFSheet sheet,
ERTable table) {
CellLocation logicalIndexCellLocation = POIUtils.findCell(sheet,
KEYWORD_LOGICAL_INDEX_MATRIX);
if (logicalIndexCellLocation != null) {
if (this.logicalIndexMatrixCellStyle == null) {
this.logicalIndexMatrixCellStyle = this.createMatrixCellStyle(
workbook, sheet, logicalIndexCellLocation);
}
setIndexMatrix(workbook, sheet, table, logicalIndexCellLocation,
this.logicalIndexMatrixCellStyle, true);
}
CellLocation physicalIndexCellLocation = POIUtils.findCell(sheet,
KEYWORD_PHYSICAL_INDEX_MATRIX);
if (physicalIndexCellLocation != null) {
if (this.physicalIndexMatrixCellStyle == null) {
this.physicalIndexMatrixCellStyle = this.createMatrixCellStyle(
workbook, sheet, physicalIndexCellLocation);
}
setIndexMatrix(workbook, sheet, table, physicalIndexCellLocation,
this.physicalIndexMatrixCellStyle, false);
}
}
示例11: createMatrixCellStyle
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
private HSSFCellStyle createMatrixCellStyle(HSSFWorkbook workbook,
HSSFCellStyle matrixHeaderTemplateCellStyle, boolean top,
boolean right, boolean bottom, boolean left) {
HSSFCellStyle cellStyle = POIUtils.copyCellStyle(workbook,
matrixHeaderTemplateCellStyle);
if (top) {
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
}
if (right) {
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
}
if (bottom) {
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
}
if (left) {
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
}
return cellStyle;
}
示例12: buildKeywordsValueMap
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
protected Map<String, String> buildKeywordsValueMap(HSSFSheet wordsSheet,
int columnNo, String[] keywords) {
Map<String, String> keywordsValueMap = new HashMap<String, String>();
for (String keyword : keywords) {
CellLocation location = POIUtils.findCell(wordsSheet, keyword,
columnNo);
if (location != null) {
HSSFRow row = wordsSheet.getRow(location.r);
HSSFCell cell = row.getCell(location.c + 2);
String value = cell.getRichStringCellValue().getString();
if (value != null) {
keywordsValueMap.put(keyword, value);
}
}
}
return keywordsValueMap;
}
示例13: setImage
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
public void setImage(HSSFWorkbook workbook, HSSFSheet sheet) {
CellLocation cellLocation = POIUtils.findMatchCell(sheet, "\\"
+ KEYWORD_ER + ".*");
if (cellLocation != null) {
int width = -1;
int height = -1;
String value = POIUtils.getCellValue(sheet, cellLocation);
int startIndex = value.indexOf("(");
if (startIndex != -1) {
int middleIndex = value.indexOf(",", startIndex + 1);
if (middleIndex != -1) {
width = Integer.parseInt(value.substring(startIndex + 1,
middleIndex).trim());
height = Integer.parseInt(value.substring(middleIndex + 1,
value.length() - 1).trim());
}
}
this.setImage(workbook, sheet, cellLocation, width, height);
}
}
示例14: initLoopDefinitionMap
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
private void initLoopDefinitionMap(final HSSFSheet loopsSheet) {
for (int i = 2; i <= loopsSheet.getLastRowNum(); i++) {
final String templateSheetName = POIUtils.getCellValue(loopsSheet, i, 0);
if (templateSheetName == null) {
break;
}
final int firstLine = POIUtils.getIntCellValue(loopsSheet, i, 1);
final int spaceLine = POIUtils.getIntCellValue(loopsSheet, i, 2);
final String sheetName = POIUtils.getCellValue(loopsSheet, i, 3);
loopDefinitionMap.put(templateSheetName, new LoopDefinition(firstLine, spaceLine, sheetName));
}
}
示例15: setSequenceData
import org.insightech.er.util.POIUtils; //导入依赖的package包/类
/**
* �V�[�P���X�V�[�g�Ƀf�[�^��ݒ肵�܂�.
*
* @param workbook
* @param sheet
* @param sequence
*/
public void setSequenceData(final HSSFWorkbook workbook, final HSSFSheet sheet, final Sequence sequence, final ERDiagram diagram) {
String cache = Format.toString(sequence.getCache());
if (DBManagerFactory.getDBManager(diagram).isSupported(DBManager.SUPPORT_SEQUENCE_NOCACHE)) {
if (sequence.isNocache()) {
cache = "NO CACHE";
}
}
String min = Format.toString(sequence.getMinValue());
String max = Format.toString(sequence.getMaxValue());
String start = Format.toString(sequence.getStart());
String cycle = String.valueOf(sequence.isCycle()).toUpperCase();
if (H2DBManager.ID.equals(diagram.getDatabase())) {
min = "-";
max = "-";
start = "-";
cycle = "-";
}
POIUtils.replace(sheet, KEYWORD_SEQUENCE_NAME, getValue(keywordsValueMap, KEYWORD_SEQUENCE_NAME, sequence.getName()));
POIUtils.replace(sheet, KEYWORD_SEQUENCE_DESCRIPTION, getValue(keywordsValueMap, KEYWORD_SEQUENCE_DESCRIPTION, sequence.getDescription()));
POIUtils.replace(sheet, KEYWORD_INCREMENT, getValue(keywordsValueMap, KEYWORD_INCREMENT, Format.toString(sequence.getIncrement())));
POIUtils.replace(sheet, KEYWORD_MIN, getValue(keywordsValueMap, KEYWORD_MIN, min));
POIUtils.replace(sheet, KEYWORD_MAX, getValue(keywordsValueMap, KEYWORD_MAX, max));
POIUtils.replace(sheet, KEYWORD_START, getValue(keywordsValueMap, KEYWORD_START, start));
POIUtils.replace(sheet, KEYWORD_CACHE, getValue(keywordsValueMap, KEYWORD_CACHE, cache));
POIUtils.replace(sheet, KEYWORD_CYCLE, getValue(keywordsValueMap, KEYWORD_CYCLE, cycle));
}