poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 62038] slide.draw should be failsaife(r)
Date Wed, 24 Jan 2018 14:04:20 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=62038

--- Comment #4 from Wolfgang Fahl <wf@bitplan.com> ---
Here is a manuall git diff for a start:
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
@@ -41,6 +41,7 @@ import
org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeStyle;
 import
org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties;
 import
org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextField;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont;
@@ -206,9 +207,18 @@ public class XSLFTextRun implements TextRun {
     @Override
     public Double getFontSize(){
         double scale = 1;
-        CTTextNormalAutofit afit =
getParentParagraph().getParentShape().getTextBodyPr().getNormAutofit();
-        if(afit != null) {
-            scale = (double)afit.getFontScale() / 100000;
+        XSLFTextParagraph pp = getParentParagraph();
+        if (pp!=null) {
+            XSLFTextShape ps = pp.getParentShape();
+            if (ps!=null) {
+                CTTextBodyProperties tbp = ps.getTextBodyPr();
+                if (tbp!=null) {
+                    CTTextNormalAutofit afit = tbp.getNormAutofit();
+                    if(afit != null) {
+                        scale = (double)afit.getFontScale() / 100000;
+                    }
+                }
+            }
         }

         CharacterPropertyFetcher<Double> fetcher = new
CharacterPropertyFetcher<Double>(_p.getIndentLevel()){
@@ -222,7 +232,8 @@ public class XSLFTextRun implements TextRun {
             }
         };
         fetchCharacterProperty(fetcher);
-        return fetcher.getValue() == null ? null : fetcher.getValue()*scale;
+        Double result=fetcher.getValue() == null ? null :
fetcher.getValue()*scale;
+        return result;
     }

     /**
@@ -589,7 +600,7 @@ public class XSLFTextRun implements TextRun {
             setFontColor(srcFontColor);
         }

-        double srcFontSize = r.getFontSize();
+        Double srcFontSize=r.getFontSize();
         if(srcFontSize  != getFontSize()){
             setFontSize(srcFontSize);
         }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message