diff options
author | Dominik Stadler <centic@apache.org> | 2021-01-03 12:01:08 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2021-01-03 12:01:08 +0000 |
commit | 218354f5b99de0e0a69dbba6def792745d83db31 (patch) | |
tree | 02a2a1c7492216959f7218f55f18dec36a753893 /src/ooxml/java/org | |
parent | e59e84a2139470b0f60c54b6dbdea6eafca03fb0 (diff) | |
download | poi-218354f5b99de0e0a69dbba6def792745d83db31.tar.gz poi-218354f5b99de0e0a69dbba6def792745d83db31.zip |
Bug 64494: Ensure "applyAlignment" in cell-styles is enabled when necessary
Also check it when fetching currently defined cell-alignment
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885059 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org')
-rw-r--r-- | src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java index 0bebc2d119..b5ec7f2fc7 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java @@ -222,6 +222,8 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { @Override public HorizontalAlignment getAlignment() { + if(!_cellXf.getApplyAlignment()) return HorizontalAlignment.GENERAL; + CTCellAlignment align = _cellXf.getAlignment(); if(align != null && align.isSetHorizontal()) { return HorizontalAlignment.forInt(align.getHorizontal().intValue()-1); @@ -629,6 +631,8 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { @Override public VerticalAlignment getVerticalAlignment() { + if(!_cellXf.getApplyAlignment()) return VerticalAlignment.BOTTOM; + CTCellAlignment align = _cellXf.getAlignment(); if(align != null && align.isSetVertical()) { return VerticalAlignment.forInt(align.getVertical().intValue()-1); @@ -654,6 +658,8 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { */ @Override public void setAlignment(HorizontalAlignment align) { + _cellXf.setApplyAlignment(true); + getCellAlignment().setHorizontal(align); } @@ -1155,6 +1161,8 @@ public class XSSFCellStyle implements CellStyle, Duplicatable { * @param align - the type of alignment */ public void setVerticalAlignment(VerticalAlignment align) { + _cellXf.setApplyAlignment(true); + getCellAlignment().setVertical(align); } |