Skip to content

Commit

Permalink
Merge pull request #409 from liaochong/feature/4.4.1
Browse files Browse the repository at this point in the history
fix bug
  • Loading branch information
liaochong committed Dec 12, 2023
2 parents 3883751 + 081958b commit 788574b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.github.liaochong</groupId>
<artifactId>myexcel</artifactId>
<version>4.4.0</version>
<version>4.4.1</version>
<packaging>jar</packaging>

<name>myexcel</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ public abstract class AbstractExcelFactory implements ExcelFactory {
* 是否为hssf
*/
protected boolean isHssf;
/**
* 每行的单元格最大高度map
*/
private Map<Integer, Short> maxTdHeightMap = new HashMap<>();
/**
* 是否使用默认样式
*/
Expand Down Expand Up @@ -254,14 +250,6 @@ protected void createRow(Tr tr, Sheet sheet) {
}
if (tr.height > 0) {
row.setHeightInPoints(tr.height);
} else {
// 设置行高,最小12
if (maxTdHeightMap.get(row.getRowNum()) == null) {
row.setHeightInPoints(row.getHeightInPoints() + 5);
} else {
row.setHeightInPoints((short) (maxTdHeightMap.get(row.getRowNum()) + 5));
maxTdHeightMap.remove(row.getRowNum());
}
}
stagingTds.stream().filter(blankTd -> Objects.equals(blankTd.row, tr.index)).forEach(td -> {
if (tr.tdList == Collections.EMPTY_LIST) {
Expand Down Expand Up @@ -631,13 +619,6 @@ private void setCellStyle(Row row, Cell cell, Td td) {
if (td.style.isEmpty() && !applyDefaultStyle) {
return;
}
String fs = td.style.get("font-size");
if (fs != null) {
short fontSize = (short) TdUtil.getValue(fs);
if (fontSize > maxTdHeightMap.getOrDefault(row.getRowNum(), FontStyle.DEFAULT_FONT_SIZE)) {
maxTdHeightMap.put(row.getRowNum(), fontSize);
}
}
if (applyDefaultStyle) {
if (td.th) {
DEFAULT_TH_STYLE.forEach((k, v) -> td.style.putIfAbsent(k, v));
Expand Down Expand Up @@ -806,7 +787,6 @@ protected void setColWidth(Map<Integer, Integer> colMaxWidthMap, Sheet sheet, in
protected void clearCache() {
cellStyleMap = new HashMap<>();
fontMap = new HashMap<>();
maxTdHeightMap = new HashMap<>();
format = null;
createHelper = null;
imageMapping = null;
Expand Down

0 comments on commit 788574b

Please sign in to comment.