mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
try to avoid class cast issues
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
39935860ed
commit
85212023d6
@ -578,9 +578,16 @@ public class XSSFTextParagraph implements Iterable<XSSFTextRun>{
|
||||
if(lnSpc > 0) {
|
||||
// check if the percentage value is scaled
|
||||
CTTextNormalAutofit normAutofit = _shape.getTxBody().getBodyPr().getNormAutofit();
|
||||
if(normAutofit != null) {
|
||||
double scale = 1 - (double)normAutofit.getLnSpcReduction() / 100000;
|
||||
lnSpc *= scale;
|
||||
if(normAutofit != null && normAutofit.isSetLnSpcReduction()) {
|
||||
final Object lnSpcReduction = normAutofit.getLnSpcReduction();
|
||||
final int divisor = 100000;
|
||||
if (lnSpcReduction instanceof Number) {
|
||||
double scale = 1 - ((Number) lnSpcReduction).doubleValue() / divisor;
|
||||
lnSpc *= scale;
|
||||
} else if (lnSpcReduction instanceof String) {
|
||||
double scale = 1 - Double.parseDouble((String) lnSpcReduction) / divisor;
|
||||
lnSpc *= scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -130,7 +130,15 @@ public class XSSFTextRun {
|
||||
double scale = 1;
|
||||
double size = XSSFFont.DEFAULT_FONT_SIZE; // default font size
|
||||
CTTextNormalAutofit afit = getParentParagraph().getParentShape().getTxBody().getBodyPr().getNormAutofit();
|
||||
if(afit != null) scale = (double)afit.getFontScale() / 100000;
|
||||
if (afit != null && afit.isSetFontScale()) {
|
||||
final Object fs = afit.getFontScale();
|
||||
final int divisor = 100000;
|
||||
if (fs instanceof Number) {
|
||||
scale = ((Number) fs).doubleValue() / divisor;
|
||||
} else if (fs instanceof String) {
|
||||
scale = Double.parseDouble((String) fs) / divisor;
|
||||
}
|
||||
}
|
||||
|
||||
CTTextCharacterProperties rPr = getRPrOrNull();
|
||||
if(rPr != null && rPr.isSetSz()){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user