ソースを参照

自动换行

4.1.3.A
jueyue 7年前
コミット
6e77d2a2e6
4個のファイルの変更49行の追加40行の削除
  1. +36
    -35
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java
  2. +1
    -1
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java
  3. +9
    -3
      easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/base/BaseExportService.java
  4. +3
    -1
      easypoi-base/src/main/java/cn/afterturn/easypoi/word/parse/excel/ExcelEntityParse.java

+ 36
- 35
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java ファイルの表示

@@ -1,13 +1,13 @@
/** /**
* Copyright 2013-2015 JueYue (qrb.jueyue@gmail.com) * Copyright 2013-2015 JueYue (qrb.jueyue@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
@@ -22,7 +22,7 @@ import cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerDefaultImpl;
/** /**
* Excel 导出参数 * Excel 导出参数
*
*
* @author JueYue * @author JueYue
* @version 1.0 2013年8月24日 * @version 1.0 2013年8月24日
*/ */
@@ -31,86 +31,86 @@ public class ExportParams extends ExcelBaseParams {
/** /**
* 表格名称 * 表格名称
*/ */
private String title;
private String title;
/** /**
* 表格名称 * 表格名称
*/ */
private short titleHeight = 10;
private short titleHeight = 10;
/** /**
* 第二行名称 * 第二行名称
*/ */
private String secondTitle;
private String secondTitle;
/** /**
* 表格名称 * 表格名称
*/ */
private short secondTitleHeight = 8;
private short secondTitleHeight = 8;
/** /**
* sheetName * sheetName
*/ */
private String sheetName;
private String sheetName;
/** /**
* 过滤的属性 * 过滤的属性
*/ */
private String[] exclusions;
private String[] exclusions;
/** /**
* 是否添加需要需要 * 是否添加需要需要
*/ */
private boolean addIndex;
private boolean addIndex;
/** /**
* 是否添加需要需要 * 是否添加需要需要
*/ */
private String indexName = "序号";
private String indexName = "序号";
/** /**
* 冰冻列 * 冰冻列
*/ */
private int freezeCol;
private int freezeCol;
/** /**
* 表头颜色 * 表头颜色
*/ */
private short color = HSSFColor.WHITE.index;
private short color = HSSFColor.WHITE.index;
/** /**
* 属性说明行的颜色 例如:HSSFColor.SKY_BLUE.index 默认 * 属性说明行的颜色 例如:HSSFColor.SKY_BLUE.index 默认
*/ */
private short headerColor = HSSFColor.SKY_BLUE.index;
private short headerColor = HSSFColor.SKY_BLUE.index;
/** /**
* Excel 导出版本 * Excel 导出版本
*/ */
private ExcelType type = ExcelType.HSSF;
private ExcelType type = ExcelType.HSSF;
/** /**
* Excel 导出style * Excel 导出style
*/ */
private Class<?> style = ExcelExportStylerDefaultImpl.class;
private Class<?> style = ExcelExportStylerDefaultImpl.class;
/** /**
* 表头高度 * 表头高度
*/ */
private double headerHeight = 9D;
private double headerHeight = 9D;
/** /**
* 是否创建表头 * 是否创建表头
*/ */
private boolean isCreateHeadRows = true;
private boolean isCreateHeadRows = true;
/** /**
* 是否动态获取数据 * 是否动态获取数据
*/ */
private boolean isDynamicData = false;
private boolean isDynamicData = false;
/** /**
* 是否追加图形 * 是否追加图形
*/ */
private boolean isAppendGraph = true;
private boolean isAppendGraph = true;
/** /**
* 单sheet最大值 * 单sheet最大值
* 03版本默认6W行,07默认100W * 03版本默认6W行,07默认100W
*/ */
private int maxNum = 0;
private int maxNum = 0;
/** /**
* 导出时在excel中每个列的高度 单位为字符,一个汉字=2个字符 * 导出时在excel中每个列的高度 单位为字符,一个汉字=2个字符
* 全局设置,优先使用 * 全局设置,优先使用
*/ */
public short height = 0;
public short height = 0;
public ExportParams() { public ExportParams() {
@@ -261,16 +261,16 @@ public class ExportParams extends ExcelBaseParams {
this.isAppendGraph = isAppendGraph; this.isAppendGraph = isAppendGraph;
} }
public int getMaxNum() {
return maxNum;
}
public int getMaxNum() {
return maxNum;
}
public void setMaxNum(int maxNum) {
this.maxNum = maxNum;
}
public void setMaxNum(int maxNum) {
this.maxNum = maxNum;
}
public short getHeight() { public short getHeight() {
return (short) (height * 50);
return height == -1 ? -1 : (short) (height * 50);
} }
public void setHeight(short height) { public void setHeight(short height) {
@@ -284,4 +284,5 @@ public class ExportParams extends ExcelBaseParams {
public void setHeaderHeight(double headerHeight) { public void setHeaderHeight(double headerHeight) {
this.headerHeight = headerHeight; this.headerHeight = headerHeight;
} }
} }

+ 1
- 1
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java ファイルの表示

@@ -169,7 +169,7 @@ public class ExcelExportService extends BaseExportService {
int titleHeight = index; int titleHeight = index;
setCellWith(excelParams, sheet); setCellWith(excelParams, sheet);
setColumnHidden(excelParams,sheet); setColumnHidden(excelParams,sheet);
short rowHeight = entity.getHeight() > 0 ? entity.getHeight() : getRowHeight(excelParams);
short rowHeight = entity.getHeight() != 0 ? entity.getHeight() : getRowHeight(excelParams);
setCurrentIndex(1); setCurrentIndex(1);
Iterator<?> its = dataSet.iterator(); Iterator<?> its = dataSet.iterator();
List<Object> tempList = new ArrayList<Object>(); List<Object> tempList = new ArrayList<Object>();


+ 9
- 3
easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/base/BaseExportService.java ファイルの表示

@@ -75,7 +75,9 @@ public abstract class BaseExportService extends ExportCommonService {
try { try {
ExcelExportEntity entity; ExcelExportEntity entity;
Row row = sheet.createRow(index); Row row = sheet.createRow(index);
row.setHeight(rowHeight);
if (rowHeight != -1) {
row.setHeight(rowHeight);
}
int maxHeight = 1, cellNum = 0; int maxHeight = 1, cellNum = 0;
int indexKey = createIndexCell(row, index, excelParams.get(0)); int indexKey = createIndexCell(row, index, excelParams.get(0));
cellNum += indexKey; cellNum += indexKey;
@@ -211,10 +213,14 @@ public abstract class BaseExportService extends ExportCommonService {
Row row; Row row;
if (sheet.getRow(index) == null) { if (sheet.getRow(index) == null) {
row = sheet.createRow(index); row = sheet.createRow(index);
row.setHeight(rowHeight);
if (rowHeight != -1) {
row.setHeight(rowHeight);
}
} else { } else {
row = sheet.getRow(index); row = sheet.getRow(index);
row.setHeight(rowHeight);
if (rowHeight != -1) {
row.setHeight(rowHeight);
}
} }
for (int k = 0, paramSize = excelParams.size(); k < paramSize; k++) { for (int k = 0, paramSize = excelParams.size(); k < paramSize; k++) {
entity = excelParams.get(k); entity = excelParams.get(k);


+ 3
- 1
easypoi-base/src/main/java/cn/afterturn/easypoi/word/parse/excel/ExcelEntityParse.java ファイルの表示

@@ -63,7 +63,9 @@ public class ExcelEntityParse extends ExportCommonService {
try { try {
ExcelExportEntity entity; ExcelExportEntity entity;
XWPFTableRow row = table.insertNewTableRow(index); XWPFTableRow row = table.insertNewTableRow(index);
row.setHeight(rowHeight);
if (rowHeight != -1) {
row.setHeight(rowHeight);
}
int maxHeight = 1, cellNum = 0; int maxHeight = 1, cellNum = 0;
for (int k = 0, paramSize = excelParams.size(); k < paramSize; k++) { for (int k = 0, paramSize = excelParams.size(); k < paramSize; k++) {
entity = excelParams.get(k); entity = excelParams.get(k);


読み込み中…
キャンセル
保存