ソースを参照

PPTX解析,阶段性保存,效果,文字相关属性。

CrazyIter 4 年 前
コミット
9e00988515

+ 363 - 11
HTEXLib/Helpers/ShapeHelpers/PPTXHelper.cs

@@ -68,6 +68,337 @@ namespace HTEXLib.Helpers.ShapeHelpers
             string FontColor = FontReferenceColors(shapeStyle.FontReference, slide);
             return new SlideColor { LineColor = LineColor, FillColor = FillColor, EffectColor = EffectColor, FontColor = FontColor };
         }
+        public static HTEXLib.Models.HTEX.RunStyle DoRunProperties(TextCharacterPropertiesType shapeProperties, PPTSlide slide, string type, string partForm) {
+            if (shapeProperties == null)
+            {
+                return null;
+            }
+            //Outline
+            var lnNode = shapeProperties.GetFirstChild<Outline>();
+            Border border = null;
+            if (lnNode != null)
+            {
+                border = DoOutline(lnNode, slide, type);
+            }
+            Fill fill = new Fill() { type = -1 };
+            var gradFill = shapeProperties.GetFirstChild<GradientFill>();
+            if (gradFill != null)
+            {
+                fill.type = 2;
+                fill.gradientFill = DoGradientFill(gradFill, slide);
+            }
+            var noFill = shapeProperties.GetFirstChild<NoFill>();
+            if (noFill != null)
+            {
+                fill.type = 0;
+            }
+            var pattFill = shapeProperties.GetFirstChild<PatternFill>();
+            if (pattFill != null)
+            {
+                HtexPattFill htexPattFill = DoPattFill(pattFill, slide);
+                fill.type = 4;
+                fill.pattFill = htexPattFill;
+            }
+            var solidFill = shapeProperties.GetFirstChild<SolidFill>();
+            if (solidFill != null)
+            {
+                fill.type = 1;
+                fill.solidFill = DoSolidFill(solidFill, slide);
+            }
+            var groupFill = shapeProperties.GetFirstChild<GroupFill>();
+            if (groupFill != null)
+            {
+                fill.type = 5;
+                //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
+            }
+            var blipFill = shapeProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.BlipFill>();
+            if (blipFill != null)
+            {
+                fill.type = 3;
+                fill.blipFill = DoBlipFill(blipFill, slide, partForm);
+                //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
+            }
+            var EffectList = shapeProperties.GetFirstChild<EffectList>();
+            var effect = doEffect(EffectList, slide, partForm);
+            var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
+            var Scene3DType = shapeProperties.GetFirstChild<Scene3DType>();
+            var Shape3DType = shapeProperties.GetFirstChild<Shape3DType>();
+            var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
+            return new HTEXLib.Models.HTEX.RunStyle { fill = fill, border = border,effect=effect };
+        }
+
+        public static HTEXLib.Models.HTEX.Effect doEffect(EffectList effectList, PPTSlide slide,  string partForm) {
+            if (effectList == null) {
+                return null;
+            }
+            HTEXLib.Models.HTEX.Effect effect = new Models.HTEX.Effect();
+            if (effectList.Blur != null) {
+                effect.blur = new Models.HTEX.Blur
+                {
+                    radius = effectList.Blur.Radius!=null? effectList.Blur.Radius.Value * 1.0 / Globals.px12700 : 0,
+                    grow = effectList.Blur.Grow!=null?effectList.Blur.Grow.Value:false
+                };
+            }
+            if (effectList.FillOverlay != null)
+            {
+                Fill fill = DoFillOverlay(effectList.FillOverlay, slide, partForm);
+                if (fill == null || fill.type == -1 || fill.type == 0) {
+                    fill = null;
+                }
+                effect.fillOverlay = new Models.HTEX.FillOverlay
+                {
+                    fill = fill,
+                    blend = effectList.FillOverlay.Blend != null ? effectList.FillOverlay.Blend.Value.ToString() : null
+                };
+            }
+            if (effectList.Glow != null)
+            {
+                string color = DoEffectColor(slide, effectList.Glow);
+                effect.glow = new Models.HTEX.Glow
+                {
+                    color = color,
+                    rad= effectList.Glow.Radius!=null?effectList.Glow.Radius.Value * 1.0 / Globals.px12700 : 0
+                };
+            }
+            if (effectList.InnerShadow != null)
+            {
+                string color = DoEffectColor(slide, effectList.InnerShadow);
+                effect.innerShadow = new Models.HTEX.InnerShadow
+                {
+                    color = color,
+                    blurRad = effectList.InnerShadow.BlurRadius!=null?effectList.InnerShadow.BlurRadius.Value * 1.0 / Globals.px12700 : 0,
+                    dir= effectList.InnerShadow.Direction!=null?effectList.InnerShadow.Direction.Value* 1.0 / 60000 : 0,
+                    dist= effectList.InnerShadow.Distance!=null?effectList.InnerShadow.Distance.Value*1.0/Globals.px12700:0
+                };
+            }
+            if (effectList.OuterShadow != null)
+            {
+                string color = DoEffectColor(slide, effectList.OuterShadow);
+                effect.outerShadow = new Models.HTEX.OuterShadow
+                {
+                    color = color,
+                    blurRad = effectList.OuterShadow.BlurRadius!=null? effectList.OuterShadow.BlurRadius.Value*1.0/ Globals.px12700 : 0,
+                    dir = effectList.OuterShadow.Direction!=null?effectList.OuterShadow.Direction.Value * 1.0 / 60000 : 0,
+                    dist = effectList.OuterShadow.Distance!=null?effectList.OuterShadow.Distance.Value * 1.0 / Globals.px12700 : 0,
+                    rotWithShape= effectList.OuterShadow.RotateWithShape!=null?effectList.OuterShadow.RotateWithShape.Value:true,
+                    algn= effectList.OuterShadow.Alignment!=null? effectList.OuterShadow.Alignment.Value.ToString():null,
+                    ky= effectList.OuterShadow.VerticalSkew!=null? effectList.OuterShadow.VerticalSkew.Value:0,
+                    sy = effectList.OuterShadow.VerticalRatio!=null? effectList.OuterShadow.VerticalRatio.Value:0,
+                    sx= effectList.OuterShadow.HorizontalRatio!=null? effectList.OuterShadow.HorizontalRatio.Value:0,
+                    kx= effectList.OuterShadow.HorizontalSkew!=null? effectList.OuterShadow.HorizontalSkew.Value:0,
+                };
+            }
+            if (effectList.PresetShadow != null)
+            {
+                string color = DoEffectColor(slide, effectList.PresetShadow);
+                effect.presetShadow = new Models.HTEX.PresetShadow
+                {
+                    color = color,
+                    dir = effectList.PresetShadow.Direction!=null? effectList.PresetShadow.Direction.Value * 1.0 / 60000 : 0,
+                    dist = effectList.PresetShadow.Distance!=null?effectList.PresetShadow.Distance.Value * 1.0 / Globals.px12700 : 0,
+                    prst = effectList.PresetShadow.Preset!=null? effectList.PresetShadow.Preset.Value.ToString():null
+                };
+            }
+            if (effectList.Reflection != null)
+            {
+                effect.reflection = new Models.HTEX.Reflection
+                {
+                    dir = effectList.Reflection.Direction!=null ? effectList.Reflection.Direction.Value*1.0/ 60000 : 0,
+                    dist = effectList.Reflection.Distance!=null?effectList.Reflection.Distance.Value*1.0/Globals.px12700:0,
+                    blurRad = effectList.Reflection.BlurRadius!=null? effectList.Reflection.BlurRadius.Value * 1.0 / Globals.px12700 : 0,
+                    rotWithShape = effectList.Reflection.RotateWithShape!=null? effectList.Reflection.RotateWithShape.Value:true,
+                    algn = effectList.Reflection.Alignment!=null? effectList.Reflection.Alignment.Value.ToString():null,
+                    ky = effectList.Reflection.VerticalSkew!=null?effectList.Reflection.VerticalSkew.Value:0,
+                    sy = effectList.Reflection.VerticalRatio!=null? effectList.Reflection.VerticalRatio.Value:0,
+                    sx = effectList.Reflection.HorizontalRatio!=null? effectList.Reflection.HorizontalRatio.Value:0,
+                    kx = effectList.Reflection.HorizontalSkew!=null? effectList.Reflection.HorizontalSkew.Value:0,
+                    stA= effectList.Reflection.StartOpacity!=null?effectList.Reflection.StartOpacity.Value * 1.0 / 100000 : 1,
+                    stPos = effectList.Reflection.StartPosition!=null?effectList.Reflection.StartPosition.Value : 0,
+                    endA = effectList.Reflection.EndAlpha!=null?effectList.Reflection.EndAlpha.Value:0,
+                    endPos = effectList.Reflection.EndPosition!=null?effectList.Reflection.EndPosition.Value*1.0/100000:1,
+                    fadeDir = effectList.Reflection.FadeDirection!=null?effectList.Reflection.FadeDirection.Value:0,
+                };
+            }
+            if (effectList.SoftEdge != null)
+            {
+                effect.softEdge = new Models.HTEX.SoftEdge
+                {
+                    //12700
+                    rad = effectList.SoftEdge.Radius!=null? effectList.SoftEdge.Radius.Value*1.0/Globals.px12700:0,
+                };
+            }
+            return effect;
+        }
+        private static string DoEffectColor(PPTSlide slide, PresetShadow FillReference)
+        {
+            string color = null;
+            if (FillReference != null)
+            {
+                if (FillReference.RgbColorModelPercentage != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelPercentage);
+                }
+                if (FillReference.RgbColorModelHex != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelHex);
+                }
+                if (FillReference.HslColor != null)
+                {
+                    color = ReadColor(FillReference.HslColor);
+                }
+                if (FillReference.SystemColor != null)
+                {
+                    color = ReadColor(FillReference.SystemColor, slide);
+                }
+                if (FillReference.SchemeColor != null)
+                {
+                    color = ReadColor(FillReference.SchemeColor, slide);
+                }
+                if (FillReference.PresetColor != null)
+                {
+                    color = ReadColor(FillReference.PresetColor);
+                }
+            }
+            return color;
+        }
+        private static string DoEffectColor(PPTSlide slide, OuterShadow FillReference)
+        {
+            string color = null;
+            if (FillReference != null)
+            {
+                if (FillReference.RgbColorModelPercentage != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelPercentage);
+                }
+                if (FillReference.RgbColorModelHex != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelHex);
+                }
+                if (FillReference.HslColor != null)
+                {
+                    color = ReadColor(FillReference.HslColor);
+                }
+                if (FillReference.SystemColor != null)
+                {
+                    color = ReadColor(FillReference.SystemColor, slide);
+                }
+                if (FillReference.SchemeColor != null)
+                {
+                    color = ReadColor(FillReference.SchemeColor, slide);
+                }
+                if (FillReference.PresetColor != null)
+                {
+                    color = ReadColor(FillReference.PresetColor);
+                }
+            }
+            return color;
+        }
+        private static string DoEffectColor(PPTSlide slide, InnerShadow FillReference)
+        {
+            string color = null;
+            if (FillReference != null)
+            {
+                if (FillReference.RgbColorModelPercentage != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelPercentage);
+                }
+                if (FillReference.RgbColorModelHex != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelHex);
+                }
+                if (FillReference.HslColor != null)
+                {
+                    color = ReadColor(FillReference.HslColor);
+                }
+                if (FillReference.SystemColor != null)
+                {
+                    color = ReadColor(FillReference.SystemColor, slide);
+                }
+                if (FillReference.SchemeColor != null)
+                {
+                    color = ReadColor(FillReference.SchemeColor, slide);
+                }
+                if (FillReference.PresetColor != null)
+                {
+                    color = ReadColor(FillReference.PresetColor);
+                }
+            }
+            return color;
+        }
+
+        private static string DoEffectColor(PPTSlide slide,  Glow FillReference)
+        {
+            string color = null;
+            if (FillReference != null)
+            {
+                if (FillReference.RgbColorModelPercentage != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelPercentage);
+                }
+                if (FillReference.RgbColorModelHex != null)
+                {
+                    color = ReadColor(FillReference.RgbColorModelHex);
+                }
+                if (FillReference.HslColor != null)
+                {
+                    color = ReadColor(FillReference.HslColor);
+                }
+                if (FillReference.SystemColor != null)
+                {
+                    color = ReadColor(FillReference.SystemColor, slide);
+                }
+                if (FillReference.SchemeColor != null)
+                {
+                    color = ReadColor(FillReference.SchemeColor, slide);
+                }
+                if (FillReference.PresetColor != null)
+                {
+                    color = ReadColor(FillReference.PresetColor);
+                }
+            }
+            return color;
+        }
+        public static Fill DoFillOverlay(FillOverlay fillOverlay, PPTSlide slide, string partForm) {
+            Fill fill = new Fill() { type = -1 };
+            var gradFill = fillOverlay.GradientFill;
+            if (gradFill != null)
+            {
+                fill.type = 2;
+                fill.gradientFill = DoGradientFill(gradFill, slide);
+            }
+            var noFill = fillOverlay.NoFill;
+            if (noFill != null)
+            {
+                fill.type = 0;
+            }
+            var pattFill = fillOverlay.PatternFill;
+            if (pattFill != null)
+            {
+                HtexPattFill htexPattFill = DoPattFill(pattFill, slide);
+                fill.type = 4;
+                fill.pattFill = htexPattFill;
+            }
+            var solidFill = fillOverlay.SolidFill;
+            if (solidFill != null)
+            {
+                fill.type = 1;
+                fill.solidFill = DoSolidFill(solidFill, slide);
+            }
+            var groupFill = fillOverlay.GroupFill;
+            if (groupFill != null)
+            {
+                fill.type = 5;
+                //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
+            }
+            var blipFill = fillOverlay.BlipFill;
+            if (blipFill != null)
+            {
+                fill.type = 3;
+                fill.blipFill = DoBlipFill(blipFill, slide, partForm);
+                //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
+            }
+            return fill;
+        }
         public static HTEXLib.Models.HTEX.ShapeStyle DoShapeProperties(DocumentFormat.OpenXml.Drawing.Charts.ShapeProperties shapeProperties, PPTSlide slide, string type, string partForm)
         {
             if (shapeProperties == null) { 
@@ -119,12 +450,13 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
             }
             var EffectList = shapeProperties.GetFirstChild<EffectList>();
+            var effect  = doEffect(EffectList, slide,partForm);
             var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
             var Scene3DType = shapeProperties.GetFirstChild<Scene3DType>();
             var Shape3DType = shapeProperties.GetFirstChild<Shape3DType>();
             var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
             // CustomGeometry PresetGeometry  TODO
-            return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border };
+            return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border, effect=effect };
         }
         public static HTEXLib.Models.HTEX.ShapeStyle DoShapeProperties(ChartShapeProperties shapeProperties, PPTSlide slide, string type, string partForm,ChartPart chartPart)
         {
@@ -178,12 +510,13 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
             }
             var EffectList = shapeProperties.GetFirstChild<EffectList>();
+            Models.HTEX. Effect effect= doEffect(EffectList, slide, partForm);
             var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
             var Scene3DType = shapeProperties.GetFirstChild<Scene3DType>();
             var Shape3DType = shapeProperties.GetFirstChild<Shape3DType>();
             var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
             // CustomGeometry PresetGeometry  TODO
-            return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border };
+            return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border ,effect= effect };
         }
         public static HTEXLib.Models.HTEX.ShapeStyle DoShapeProperties(GroupShapeProperties shapeProperties, PPTSlide slide, string type, string partForm)
         {
@@ -233,11 +566,12 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
             }
             var EffectList = shapeProperties.GetFirstChild<EffectList>();
+            Models.HTEX.Effect effect = doEffect(EffectList, slide, partForm);
             var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
             var Scene3DType = shapeProperties.GetFirstChild<Scene3DType>();
             var Shape3DType = shapeProperties.GetFirstChild<Shape3DType>();
             var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
-            return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border };
+            return new HTEXLib.Models.HTEX.ShapeStyle { fill = fill, border = border ,effect=effect};
         }
         public static TbStyle DoTableProperties(TableProperties shapeProperties, PPTSlide slide, string type, string partForm)
         {
@@ -294,6 +628,11 @@ namespace HTEXLib.Helpers.ShapeHelpers
             if (fill != null )
             {
                 tbStyle.fill = fill;
+
+            }
+            if (tbStyle.fill.type == -1)
+            {
+                tbStyle.fill = null;
             }
             //TODO
             var EffectList = shapeProperties.GetFirstChild<EffectList>();
@@ -322,6 +661,10 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 var FillReference = TableBackground.GetFirstChild<FillReference>();
                 fill=  DoFillReference(slide, fill, FillReference);
                 tbStyle.fill = fill;
+                if (tbStyle.fill.type == -1)
+                {
+                    tbStyle.fill = null;
+                }
                 //TODO
                 TableBackground.GetFirstChild<EffectPropertiesType>();
                 TableBackground.GetFirstChild<EffectReference>();
@@ -756,6 +1099,10 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 var FillReference = TableCellStyle.GetFirstChild<FillReference>();
                 fill= DoFillReference(slide, fill, FillReference);
                 cellStyle.fill = fill;
+                if (cellStyle.fill.type == -1)
+                {
+                    cellStyle.fill = null;
+                }
                 //TODO
                 var Cell3DProperties = TableCellStyle.GetFirstChild<Cell3DProperties>();
             }
@@ -806,6 +1153,10 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
             }
             cellStyle.fill = fill;
+            if (cellStyle.fill.type == -1)
+            {
+                cellStyle.fill = null;
+            }
             List<CellBorder> cellBorders = new List<CellBorder>();
             var LeftBorder = shapeProperties.LeftBorderLineProperties;
             if (LeftBorder != null)
@@ -904,11 +1255,12 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 //  fill.solidFill = ReadSolidFillColors(new SolidFill(solidFill.ToString()), slide);
             }
             var EffectList= shapeProperties.GetFirstChild<EffectList>();
+            var effect= doEffect(EffectList, slide, partForm);
             var EffectDag = shapeProperties.GetFirstChild<EffectDag>();
             var Scene3DType = shapeProperties.GetFirstChild<Scene3DType>();
             var Shape3DType = shapeProperties.GetFirstChild<Shape3DType>();
             var ShapePropertiesExtensionList = shapeProperties.GetFirstChild<ShapePropertiesExtensionList>();
-            return new HTEXLib.Models.HTEX.ShapeStyle {fill=fill,border= border };
+            return new HTEXLib.Models.HTEX.ShapeStyle {fill=fill,border= border ,effect= effect };
         }
         public static Fill DoBackgroundProperties(DocumentFormat.OpenXml.Presentation.BackgroundProperties shapeProperties, PPTSlide slide, string partForm)
         {
@@ -1107,7 +1459,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
         /// <param name="shapeProperties"></param>
         /// <param name="slide"></param>
         public static Border DoOutline(DocumentFormat.OpenXml.Drawing.LinePropertiesType outline, PPTSlide slide,string  Shapetype) {
-            Border border = new Border() {color= new Fill { type=-1} };
+            Border border = new Border() {color= new Fill { type=-1},type="none" };
             //20.1.10.35     EMUs. 1 pt = 12700 EMUs.
             double? Width = null;
             if (outline == null && Shapetype== "CxnSp") {
@@ -1629,7 +1981,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
         {
             string FontColor = "";
             FontColor = "#" + RgbColorModelHex.Val;
-            FontColor = "#" + ShapeHelper.ColorToning(RgbColorModelHex.OuterXml, FontColor.Replace("#", ""));
+            FontColor = "#" + ShapeHelper.ColorToning(RgbColorModelHex.OuterXml, FontColor.Replace("#", "")).Replace("#","");
             return FontColor;
         }
         public static string ReadColor(DocumentFormat.OpenXml.Drawing.RgbColorModelPercentage RgbColorModelPercentage)
@@ -1641,20 +1993,20 @@ namespace HTEXLib.Helpers.ShapeHelpers
             var colorFromRGB = System.Drawing.Color.FromArgb(red, green, blue);
             string fontcolor = System.Drawing.ColorTranslator.ToHtml(colorFromRGB);
             FontColor = fontcolor;
-            FontColor = "#" + ShapeHelper.ColorToning(RgbColorModelPercentage.OuterXml, FontColor.Replace("#", ""));
+            FontColor = "#" + ShapeHelper.ColorToning(RgbColorModelPercentage.OuterXml, FontColor.Replace("#", "")).Replace("#", "");
             return FontColor;
         }
         public static string ReadColor(DocumentFormat.OpenXml.Drawing.SystemColor SystemColor, PPTSlide slide)
         {
             string FontColor = "";
             FontColor = "#" + SystemColor.LastColor.Value;
-            FontColor = "#" + ShapeHelper.ColorToning(SystemColor.OuterXml, FontColor.Replace("#", ""));
+            FontColor = "#" + ShapeHelper.ColorToning(SystemColor.OuterXml, FontColor.Replace("#", "")).Replace("#", "");
             return FontColor;
         }
         public static string ReadColor(DocumentFormat.OpenXml.Drawing.SchemeColor SchemeColor,PPTSlide slide) {
             string FontColor = "";
             FontColor = DoSchemeColor(SchemeColor, slide);
-            FontColor = "#" + ShapeHelper.ColorToning(SchemeColor.OuterXml, FontColor.Replace("#", ""));
+            FontColor = "#" + ShapeHelper.ColorToning(SchemeColor.OuterXml, FontColor.Replace("#", "")).Replace("#", "");
             return FontColor;
         }
         public static string ReadColor(DocumentFormat.OpenXml.Drawing.HslColor HslColor)
@@ -1665,7 +2017,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
             var lum =HslColor.LumValue / 100;
             var hsl2rgb = ShapeHelper.HslToRgb(hue, sat, lum);
             FontColor = "#" + ShapeHelper.ToHex(hsl2rgb.r) + ShapeHelper.ToHex(hsl2rgb.g) + ShapeHelper.ToHex(hsl2rgb.b);
-            FontColor = "#" + ShapeHelper.ColorToning(HslColor.OuterXml, FontColor.Replace("#", ""));
+            FontColor = "#" + ShapeHelper.ColorToning(HslColor.OuterXml, FontColor.Replace("#", "")).Replace("#", "");
             return FontColor;
         }
         public static string ReadColor(PresetColor PresetColor) {
@@ -1673,7 +2025,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
             //https://m.fontke.com/tool/rgb/0000ff/
             //判断是否是拿到名字 还是值
             FontColor = ShapeHelper.GetColorName2Hex(PresetColor.Val);
-            FontColor = "#" + ShapeHelper.ColorToning(PresetColor.OuterXml, FontColor.Replace("#", ""));
+            FontColor = "#" + ShapeHelper.ColorToning(PresetColor.OuterXml, FontColor.Replace("#", "")).Replace("#", "");
             //TODO
             return FontColor;
         }

ファイルの差分が大きいため隠しています
+ 2 - 2
HTEXLib/Helpers/ShapeHelpers/ShapeHelper.cs


+ 0 - 21
HTEXLib/Models/Attach.cs

@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace HTEXLib.Models
-{
-    /// <summary>
-    /// (HiTeach 附件)
-    /// </summary>
-    public class Attach:Item
-    {
-        public new  string type { get; set; } = "Attach";
-        public string url { get; set; }
-        /// <summary>
-        /// 附件名称
-        /// </summary>
-        public string name { get; set; }
-        
-        public HTEXLib.Models.HTEX.ShapeStyle style { get; set; } = new Models.HTEX.ShapeStyle();
-    }
-}

+ 1 - 4
HTEXLib/Models/Brush.cs

@@ -17,9 +17,6 @@ namespace HTEXLib
         public string brushType { get; set; }
         //由于point_xy 已经定义了画笔开始的坐标点,大小等。
         // public HTEXLib.Models.HTEX.ShapeStyle style { get; set; } = new Models.HTEX.ShapeStyle();
-    }
-    public class BrushStyle
-    {
         /// <summary>
         /// #FFFF0000
         /// </summary>
@@ -40,6 +37,6 @@ namespace HTEXLib
         /// "{0,1,1,-1,0,0}", // *om* // 畫筆 筆尖 矩陣
         /// </summary>
         public string stylustip_transform { get; set; }
-
     }
+    
 }

+ 12 - 8
HTEXLib/Models/FontStyle.cs

@@ -1,3 +1,4 @@
+using HTEXLib.Models.HTEX;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -6,6 +7,8 @@ namespace HTEXLib
 {
     public  class FontStyle
     {
+        public Fill fill { get; set; }
+        public Border border { get; set; }
         /// <summary>
         /// 
         /// font-family、font-style、font-weight、font-variant、font-stretch、font-size、font-size-adjust、
@@ -40,19 +43,20 @@ namespace HTEXLib
         /// <summary>
         /// 
         /// </summary>
-        public double top { get; set; }
+       // public double top { get; set; }
         /// <summary>
         /// 
         /// </summary>
-        public double left { get; set; }
+       // public double left { get; set; }
         /// <summary>
         /// 不可见的
         /// </summary>
-        public bool Invisible { get; set; }
-        public bool isBullet { get; set; }
-        public double rot { get; set; }
-        public double width { get; set; }
-        public bool pictureBullet { get; set; }
-        public double bulletSize { get; set; }
+      //  public bool Invisible { get; set; }
+       // public bool isBullet { get; set; }
+      //  public double rot { get; set; }
+     //   public double width { get; set; }
+      //  //public bool pictureBullet { get; set; }
+      //  public double bulletSize { get; set; }
+      public Effect effect { get; set; }
     }
 }

+ 147 - 29
HTEXLib/Models/HTEX/HtexChart.cs

@@ -97,9 +97,10 @@ namespace HTEXLib.Models.HTEX
                 var ChartShapeProperties = Chart.Title.ChartShapeProperties;
                 shapeStyle = PPTXHelper.DoShapeProperties(ChartShapeProperties, slide, type, partForm, chartPart);
             }
-            LinkedList<PPTParagraph> PPTParagraphs=  DoChartTitle(Chart.Title);
-            List<Paragraph> paragraphs = DrawText(PPTParagraphs);
-            Shape shape= new Shape { type = "Sp", shapeType = "rect", paragraph = paragraphs };
+            var(PPTParagraphs, tBody)   =  DoChartTitle(Chart.Title);
+            TextBody textBody = DrawText(PPTParagraphs, tBody);
+
+            Shape shape= new Shape { type = "Sp", shapeType = "rect", textBody = textBody };
             shape.style.fill = shapeStyle != null ? shapeStyle.fill : null;
             shape.style.border = shapeStyle != null ? shapeStyle.border : null;
             var  chart= new Chart {sid=sid, id = this.id,  charts =charts,title=shape};
@@ -107,13 +108,22 @@ namespace HTEXLib.Models.HTEX
             chart.style.position = position;
             chart.style.fill = shapeStyleChart != null ? shapeStyleChart.fill : null;
             chart.style.border = shapeStyleChart != null ? shapeStyleChart.border : null;
+            chart.style.effect= shapeStyleChart != null ? shapeStyleChart.effect : null;
+            if (chart.style.fill.type == -1|| chart.style.fill.type == 0)
+            {
+                chart.style.fill = null;
+            }
+            if (chart.style.border != null && chart.style.border.type == "none")
+            {
+                chart.style.border = null;
+            }
             return chart;
         }
-        public LinkedList<PPTParagraph> DoChartTitle(DocumentFormat.OpenXml.Drawing.Charts.Title title)
+        public (LinkedList<PPTParagraph> paragraphs, TextBody textBody) DoChartTitle(DocumentFormat.OpenXml.Drawing.Charts.Title title)
         {
             if (title==null  ||title.ChartText == null)
             {
-                return null;
+                return (null, null);
             }
             LinkedList<PPTParagraph> Texts = new LinkedList<PPTParagraph>();
             var BodyProperties = title.ChartText.RichText.BodyProperties;
@@ -141,13 +151,13 @@ namespace HTEXLib.Models.HTEX
             }
 
             int fontScale = 100000;
-            if (BodyProperties.GetFirstChild<NormalAutoFit>() != null &&
-                    BodyProperties.GetFirstChild<NormalAutoFit>().FontScale != null)
-            {
-                fontScale = BodyProperties.GetFirstChild<NormalAutoFit>().FontScale.Value;
-            }
+            double LineSpaceReduction = 0;
+            TextBody textBody=   fillPropertiesFromMasterShape(title.ChartText.RichText, ref fontScale ,ref LineSpaceReduction);
+            textBody.lnSpRn = LineSpaceReduction;
             var ExtensionList = title.ExtensionList;
             var Paragraphs = title.ChartText.RichText.Elements<DocumentFormat.OpenXml.Drawing.Paragraph>();
+            int buIndex = 1;
+            BuChar buChar = new BuChar();
             foreach (var paragraph in Paragraphs)
             {
                 PlaceholderShape placeholder = null;
@@ -162,8 +172,8 @@ namespace HTEXLib.Models.HTEX
 
                     par.Level = level;
                 }
-                par.SetParagraphProperties(paragraph, slide.SlidePart,
-                                        slide.shapeListStyleMaster, slide.shapeListStyleLayout);
+               par.SetParagraphProperties(paragraph, slide.SlidePart,
+                                        slide.shapeListStyleMaster, slide.shapeListStyleLayout,buChar);
                 bool hasText = false;
                 foreach (var obj in paragraph.ChildElements)
                 {
@@ -173,13 +183,108 @@ namespace HTEXLib.Models.HTEX
                 //If we don't have text it still outputs the bullet character. 
                 if (par.bullet != null && hasText)
                 {
-                    par.RunPropList.Insert(0, par.bullet);
+                    par.bullet.FontSize = par.RunPropList[0].FontSize;
+                    par.bullet.FontColor = par.RunPropList[0].FontColor;
+                    par.bullet.bullIndex = buChar.index - 1;
+                    //   par.RunPropList.Insert(0, par.bullet);
+                }
+                else
+                {
+                    if (buChar != null)
+                    {
+                        buChar.index = 1;
+                    }
                 }
                 Texts.AddLast(par);
             }
-            return Texts;
+            return (Texts,textBody);
         }
-        public List<Paragraph> DrawText(LinkedList<PPTParagraph> Texts)
+
+        private TextBody fillPropertiesFromMasterShape(DocumentFormat.OpenXml.Drawing.Charts.TextBodyType TxBody/*, bool isLayout, bool addListStyle*/ , ref int fontScale ,ref double LineSpaceReduction)
+        {
+            TextBody textBody = new TextBody();
+            if (null != TxBody)
+            {
+                //    if (TxBody.ListStyle != null && addListStyle)
+                //    {
+                //        if (isLayout)
+                //            slide.shapeListStyleLayout = TxBody.ListStyle;
+                //        else
+                //            slide.shapeListStyleMaster = TxBody.ListStyle;
+                //    }
+                if (TxBody.BodyProperties != null && TxBody.BodyProperties.Anchor != null)
+                    textBody.anchor = TxBody.BodyProperties.Anchor;
+                if (TxBody.BodyProperties.TopInset != null)
+                {
+                    textBody.top = System.Math.Round((double)TxBody.BodyProperties.TopInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties.BottomInset != null)
+                {
+                    textBody.bottom = System.Math.Round((double)TxBody.BodyProperties.BottomInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties.RightInset != null)
+                {
+                    textBody.right = System.Math.Round((double)TxBody.BodyProperties.RightInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties.LeftInset != null)
+                {
+                    textBody.left = System.Math.Round((double)TxBody.BodyProperties.LeftInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties != null &&
+                 TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>() != null && TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().FontScale != null)
+                {
+                    fontScale = TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().FontScale.Value;
+                }
+                if (TxBody.BodyProperties != null &&
+                    TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>() != null && TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().LineSpaceReduction != null)
+                {
+                    LineSpaceReduction = TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().LineSpaceReduction.Value;
+                }
+                if (TxBody.BodyProperties.AnchorCenter != null)
+                {
+                    textBody.anchorCtr = TxBody.BodyProperties.AnchorCenter;
+                }
+                if (TxBody.BodyProperties.RightToLeftColumns != null)
+                {
+                    textBody.rtlCol = TxBody.BodyProperties.RightToLeftColumns;
+                }
+                if (TxBody.BodyProperties.Wrap != null)
+                {
+                    textBody.wrap = TxBody.BodyProperties.Wrap;
+                }
+                if (TxBody.BodyProperties.Vertical != null)
+                {
+                    textBody.vert = TxBody.BodyProperties.Vertical;
+                }
+                if (TxBody.BodyProperties.Rotation != null)
+                {
+                    rot = TxBody.BodyProperties.Rotation.Value / 60000.0;
+                }
+                var elements = TxBody.BodyProperties.ChildElements;
+                foreach (var element in elements)
+                {
+                    if (element is NoAutoFit)
+                    {
+                        //此元素指定文本主体内的文本不应自动适合于边框。 自动拟合是当文本框内的文本被缩放以保持在文本框内时。
+                        textBody.autoFit = false;
+                    }
+                    if (element is NormalAutoFit normalAutoFit)
+                    {
+                        //每个形状的文本都停留在该形状的范围内
+                        textBody.autoFit = true;
+                        fontScale = normalAutoFit.FontScale != null ? normalAutoFit.FontScale.Value : 0;
+                    }
+                    if (element is ShapeAutoFit)
+                    {
+                        //每个形状的文本都停留在该形状的范围内。
+                        textBody.autoFit = true;
+                    }
+                    //TODO  3D Scene3DType  Shape3DType FlatText
+                }
+            }
+            return textBody;
+        }
+        public TextBody DrawText(LinkedList<PPTParagraph> Texts, TextBody textBody)
         {
             if (Texts == null) {
                 return null;
@@ -188,7 +293,7 @@ namespace HTEXLib.Models.HTEX
             foreach (var par in Texts)
             {
                 double paragraphTop = par.getSpaceBeforePoints();
-                Paragraph paragraph = new HTEXLib.Paragraph { animatable = par.Animatable, invisible = par.Invisible };
+                Paragraph paragraph = new HTEXLib.Paragraph { /*animatable = par.Animatable, invisible = par.Invisible */};
                
                 paragraph.style.hori = par.Align;
                 paragraph.style.vert = VerticalAlign;
@@ -198,7 +303,7 @@ namespace HTEXLib.Models.HTEX
                     paragraph.buChar = new BuChar
                     {
                         type=bullet.BulletType,
-                        left = bullet.Left,
+                        //left = bullet.Left,
                         buchar = bullet.Text,
                         color = bullet.FontColor,
                         typeface = bullet.FontFamily,
@@ -256,35 +361,44 @@ namespace HTEXLib.Models.HTEX
 
                     if (text.isBullet && text.Text != null && text.Text.Contains("rId"))
                     {
-                        t1.PictureBullet = true;
+                     //   t1.PictureBullet = true;
                         t1.width = text.bulletSize;
                         t1.bulletSize = text.bulletSize;
                         newTop = text.bulletSize;
                     }
                     t1.Text = text.Text;
                     textElements.Add(t1);
+                    RunStyle runStyle = PPTXHelper.DoRunProperties(text.runProp, slide, "text", partForm);
+                    if (runStyle.border != null && (runStyle.border.color.type == -1 || runStyle.border.color.type == 0))
+                    {
+                        runStyle.border.color = null;
+                    }
                     texts.Add(new Text
                     {
+                        
                         content = t1.Text,
                         link=text.link,
                         linkType=text.linkType,
                         style = new FontStyle
                         {
+                            fill = runStyle.fill.type == -1 || runStyle.fill.type == 0 ? null : runStyle.fill,
+                            border = runStyle.border,
+                            effect = runStyle.effect,
                             align = par.FontAlign,
                             spacing = par.defTabSize,
                             color = text.FontColor,
                             family = text.FontFamily,
-                            top = top,
-                            left = left,
+                            //top = top,
+                           // left = left,
                             size = text.FontSize,
-                            isBullet = text.isBullet,
+                           // isBullet = text.isBullet,
                             underline = t1.underline,
                             italic = text.Italic,
                             bold = text.Bold,
-                            rot = this.rot,
-                            width = t1.width,
-                            pictureBullet = t1.PictureBullet,
-                            bulletSize = t1.bulletSize
+                            //rot = this.rot,
+                            //width = t1.width,
+                           // pictureBullet = t1.PictureBullet,
+                            //bulletSize = t1.bulletSize
                         }
                     }); 
                     processedElements.Add(t1);
@@ -299,7 +413,6 @@ namespace HTEXLib.Models.HTEX
                         mergedTextElements.Add(textElement);
                     else
                         mergedTextElements[mergedTextElements.Count - 1].Text += textElement.Text;
-
                     lastTxt = textElement;
                 }
 
@@ -310,12 +423,17 @@ namespace HTEXLib.Models.HTEX
                 top += newTop;
                 top += par.getSpaceAfterPoints(newTop);
                 top += par.getSpaceBeforePoints(newTop);
-
-
                 paragraph.texts = texts;
                 Paragraphs.Add(paragraph);
             }
-            return Paragraphs;
+            if (textBody == null)
+            {
+                return null;
+            }
+            else {
+                textBody.paragraphs = Paragraphs;
+            }
+            return textBody;
         }
         private String getStringFromTextElements(List<HtexText> elements)
         {

+ 14 - 0
HTEXLib/Models/HTEX/HtexConnectionShape.cs

@@ -54,6 +54,8 @@ namespace HTEXLib.Models.HTEX
             var shapeTypeNode = connectionShape.element.ShapeProperties.GetFirstChild<PresetGeometry>();
             var shapeType= shapeTypeNode.Preset.InnerText;
             var otl = connectionShape.element.ShapeProperties.GetFirstChild<Outline>();
+
+            ShapeStyle  shapeStyle= PPTXHelper.DoShapeProperties(connectionShape.element.ShapeProperties, slide, "CxnSp", partForm);
             var shapeBorder = PPTXHelper.DoOutline(otl, slide,type);
             //从ShapeProperties 获取 p:spPr
             //再从 ShapeStyle 获取 p:spPr
@@ -64,12 +66,24 @@ namespace HTEXLib.Models.HTEX
                     shapeBorder.color.type = 2;
                 }
             }
+           
             Svg svg = PPTXSvg.GenShapeSvg(connectionShape.element, index, shapeType, position,   shapeBorder);
             //  position = position ,mediaType = "image",type = type,index = index,animatable = animatable ,invisible = invisible
             Connector item = new Connector { sid =sid, type =type,cxnType=shapeType/*, invisible = invisible, animatable = animatable*/, index = index, id = id, svg = svg };
             item.style.position = position;
             item.style.border = shapeBorder;
             item.uid = connectionShape.suid;
+            if (shapeStyle != null && shapeStyle.effect!=null) {
+                item.style.effect = shapeStyle.effect;
+            }
+            if (item.style.border!=null  && (item.style.border.color.type == -1|| item.style.border.color.type == 0))
+            {
+                item.style.border.color = null;
+            }
+            if (item.style.border != null && item.style.border.type == "none")
+            {
+                item.style.border = null;
+            }
             return new List<Item>() { item }; 
         }
     }

+ 13 - 0
HTEXLib/Models/HTEX/HtexGroupShape.cs

@@ -34,6 +34,7 @@ namespace HTEXLib.Models.HTEX
             Group group = new Group() { sid = sid,id = this.id, type = type, index = index/*, animatable = animatable, invisible = invisible */};
             group.style.border = ShapeStyle.border;
             group.style.fill = ShapeStyle.fill;
+            group.style.effect = ShapeStyle.effect;
             group.style.position = position;
             group.uid = groupShape.suid;
             //SlideColor slideColor = PPTXHelper.DoShapeStyle(groupShape.element.ShapeStyle, slide, type);
@@ -47,6 +48,18 @@ namespace HTEXLib.Models.HTEX
             if (elements != null) {
                 group.shapes = elements;
             }
+            if (group.style.fill.type == -1|| group.style.border.color.type == 0)
+            {
+                group.style.fill = null;
+            }
+            if (group.style.border != null && (group.style.border.color.type == -1|| group.style.border.color.type == 0))
+            {
+                group.style.border.color = null;
+            }
+            if (group.style.border != null && group.style.border.type == "none")
+            {
+                group.style.border = null;
+            }
             return new List<Item>() { group }; 
         }
     }

+ 12 - 0
HTEXLib/Models/HTEX/HtexImage.cs

@@ -38,6 +38,7 @@ namespace HTEXLib.Models.HTEX
             var ShapeStyle = PPTXHelper.DoShapeProperties(image.element.ShapeProperties, slide,type,partForm);
             Media media = new Media() { sid = sid, id = this.id, mediaType = "image",type=type,index=index/*,animatable=animatable ,invisible=invisible*/};
             media.style.position = position;
+            media.style.effect = ShapeStyle.effect;
             /*
              *  cNvPicPr (非可视图片绘图属性)	§19.3.1.11
                 cNvPr (非可视绘图属性)	§19.3.1.12
@@ -111,6 +112,17 @@ namespace HTEXLib.Models.HTEX
             HtexBlipFill htexBlipFill = PPTXHelper.DoBlipFill(image.element.BlipFill, slide,partForm);
             media.image = htexBlipFill;
             media.uid = image.suid;
+            if (media.style.fill.type == -1|| media.style.fill.type == 0) {
+                media.style.fill = null;
+            }
+            if (media.style.border != null && (media.style.border.color.type == -1|| media.style.border.color.type == 0))
+            {
+                media.style.border.color = null;
+            }
+            if (media.style.border != null && media.style.border.type == "none")
+            {
+                media.style.border = null;
+            }
             //TODO  处理公式图片
             return new List<Item>() { media }; 
         }

+ 13 - 0
HTEXLib/Models/HTEX/HtexMath.cs

@@ -47,6 +47,7 @@ namespace HTEXLib.Models.HTEX
             var shapeTypeNode = pptMath.element.ShapeProperties.GetFirstChild<PresetGeometry>();
             Math math = new Math { sid = sid, id = this.id, type = type, index = index/*, animatable = animatable, invisible = invisible*/ };
             math.style.position = position;
+            math.style.effect = ShapeStyle.effect;
             SlideColor slideColor = PPTXHelper.DoShapeStyle(pptMath.element.ShapeStyle, slide, type);
             //从ShapeProperties 获取 p:spPr
             //再从 ShapeStyle 获取 p:spPr
@@ -162,6 +163,18 @@ namespace HTEXLib.Models.HTEX
                 }
             }
             math.uid = pptMath.suid;
+            if (math.style.fill.type == -1 || math.style.fill.type == 0)
+            {
+                math.style.fill = null;
+            }
+            if (math.style.border != null && (math.style.border.color.type == -1|| math.style.border.color.type == 0))
+            {
+                math.style.border.color = null;
+            }
+            if (math.style.border != null && math.style.border.type == "none")
+            {
+                math.style.border = null;
+            }
             return new List<Item> { math };
         }
         /// <summary>

+ 91 - 30
HTEXLib/Models/HTEX/HtexShape.cs

@@ -48,7 +48,7 @@ namespace HTEXLib.Models.HTEX
             Position position = new Position { cx= width, cy= height, x=left,y=top,rot=rot};
             var ShapeStyle =PPTXHelper.DoShapeProperties(Shape.element.ShapeProperties, slide,type,partForm);
             //position = position ,mediaType = "image",type = type,index = index,animatable = animatable ,invisible = invisible
-            Shape shape = new Shape() { sid = sid, id =this.id, paragraph = DrawText() ,type=type,index=index/*,animatable=animatable,invisible=invisible*/ };
+            Shape shape = new Shape() { sid = sid, id =this.id, textBody = DrawText() ,type=type,index=index/*,animatable=animatable,invisible=invisible*/ };
             shape.style.position = position;
             var shapeTypeNode = Shape.element.ShapeProperties.GetFirstChild<PresetGeometry>();
             var shapeTypeCustom = Shape.element.ShapeProperties.GetFirstChild<CustomGeometry>();
@@ -80,8 +80,8 @@ namespace HTEXLib.Models.HTEX
                 shape.style.fill = ShapeStyle.fill;
             }
             
-            if (shape.paragraph != null) {
-                shape.paragraph.ForEach(x => {
+            if (shape.textBody!=null  &&  shape.textBody.paragraphs != null) {
+                shape.textBody.paragraphs.ForEach(x => {
                     if (x.texts != null) {
                         x.texts.ForEach(y => {
                             if (y.style.color == null) {
@@ -204,36 +204,68 @@ namespace HTEXLib.Models.HTEX
             }
             var elmt = new List<Item> ();
             shape.uid = Shape.suid;
+             
+            if (shape.style.fill.type == -1|| shape.style.fill.type == 0)
+            {
+                shape.style.fill = null;
+            }
+            if (shape.style.border != null && (shape.style.border.color.type == -1|| shape.style.border.color.type == 0))
+            {
+                shape.style.border.color = null;
+            }
+            if (shape.style.border != null && shape.style.border.type == "none")
+            {
+                shape.style.border = null;
+            }
+            shape.style.effect = ShapeStyle.effect;
             elmt.Add(shape);
             return elmt;
         }
-        public List<Paragraph> DrawText() {
+        public TextBody  DrawText() {
             double top = getTopForCurrentAnchoring(this.Shape.Anchor, this.Shape.Texts);
+            TextBody textBody = new TextBody {
+                anchor = Shape.Anchor.ToString(),
+                anchorCtr = Shape.AnchorCenter != null ? Shape.AnchorCenter.Value : false,
+                rtlCol = Shape.RightToLeftColumns != null ? Shape.RightToLeftColumns.Value : false,
+                wrap = Shape.Wrap.ToString(),
+                vert = Shape.Vertical.ToString(),
+                rot = Shape.rot,
+                autoFit=Shape.autoFit,
+                top=Shape.TopInset,
+                bottom=Shape.BottomInset,
+                left=Shape.LeftInset,
+                right=Shape.RightInset
+            };
             List<Paragraph> Paragraphs = new List<Paragraph>();
             foreach (var par in Shape.Texts)
             {
                 double paragraphTop = this.top + (this.Shape.Anchor.Equals(DocumentFormat.OpenXml.Drawing.TextAnchoringTypeValues.Top) ? par.getSpaceBeforePoints() : 0);
-                Paragraph paragraph= new HTEXLib.Paragraph { animatable = par.Animatable ,invisible=par.Invisible};
-                paragraph.style.position.y = paragraphTop;
-                paragraph.style.position.x =this.left;
-                paragraph.style.position.cx = width;
-                paragraph.style.position.cy = height;
-                paragraph.style.position.rot = rot;
+                Paragraph paragraph= new HTEXLib.Paragraph { /*animatable = par.Animatable ,invisible=par.Invisible*/};
+                //paragraph.style.position.y = paragraphTop;
+                //paragraph.style.position.x =this.left;
+                //paragraph.style.position.cx = width;
+                //paragraph.style.position.cy = height;
+                //paragraph.style.position.rot = rot;
                 paragraph.style.vert = this.Shape.Anchor.ToString();
+                paragraph.style.indent = par.marginLeft + par.Indent;
                 paragraph.style.hori = par.Align;
-                paragraph.style.writing = Shape.WritingMode;
+
+               
+               
+                // paragraph.style.writing = Shape.WritingMode;
                 if (par.bullet != null) {
                     var bullet = par.bullet;
-                    paragraph.buChar = new BuChar 
+                    paragraph.buChar = new BuChar
                     {
                         type = bullet.BulletType,
-                        left = bullet.Left ,
-                        buchar=bullet.Text,
+                        //left = bullet.Left,
+                        buchar = bullet.Text,
                         color=bullet.FontColor,
                         typeface=bullet.FontFamily,
                         size=bullet.FontSize,
-
+                        index = bullet.bullIndex,
                     };
+                    paragraph.style.indent = par.marginLeft + par.Indent +bullet.FontSize*bullet.bulletPct;
                 }
                
                 double newTop = par.getSpaceBeforePoints();
@@ -248,9 +280,14 @@ namespace HTEXLib.Models.HTEX
                 List<HtexText> processedElements = new List<HtexText>();
                 List<Text> texts = new List<Text>();
                 IEnumerable<PPTRunProperties> pPTRunProperties = breakTextsToShape(par);
+                //行内最大字体
+                double lineInMaxFontSize = 0;
                 foreach (var text in pPTRunProperties)
                 {
-                    float points = float.Parse(text.FontSize.ToString()) * 72.0F / 96.0F;
+                    float points =0;
+                    if (text.FontSize!=0) {
+                        points = float.Parse(text.FontSize.ToString()) * 72.0F / 96.0F;
+                    }
                     Font font = new System.Drawing.Font(text.FontFamily.ToString(), points);
                     if (text.Bold) font = new System.Drawing.Font(text.FontFamily.ToString(), points, System.Drawing.FontStyle.Bold);
                     else if (text.Italic)
@@ -291,18 +328,23 @@ namespace HTEXLib.Models.HTEX
                     {
                         Rotate = this.rot
                     };
-                    t1.width = MeasureString(text.Text, font);
+                   // t1.width = MeasureString(text.Text, font);
 
                     if (text.isBullet && text.Text != null && text.Text.Contains("rId"))
                     {
-                        t1.PictureBullet = true;
-                        t1.width = text.bulletSize;
+                      //  t1.PictureBullet = true;
+                      //  t1.width = text.bulletSize;
                         t1.bulletSize = text.bulletSize;
                         newTop = text.bulletSize;
                     }
-                   
+                    
                     t1.Text = text.Text;
                     textElements.Add(t1);
+
+                    RunStyle runStyle=  PPTXHelper.DoRunProperties(text.runProp, slide, "text", partForm);
+                    if (runStyle.border != null && (runStyle.border.color.type == -1 || runStyle.border.color.type == 0)) {
+                        runStyle.border.color = null;
+                    }
                     texts.Add(new Text
                     {
                         content = t1.Text,
@@ -310,25 +352,35 @@ namespace HTEXLib.Models.HTEX
                         linkType = text.linkType,
                         style = new FontStyle
                         {  
-                            align=par.FontAlign,
+                            fill= runStyle.fill.type == -1|| runStyle.fill.type == 0 ? null : runStyle.fill,
+                            effect=runStyle.effect,
+                            border =runStyle.border,
+                            align =par.FontAlign,
                             spacing=par.defTabSize,
                             color = text.FontColor,
                             family = text.FontFamily,
-                            top = top,
-                            left = left,
+                            //top = top,
+                            //left = left,
                             size = text.FontSize,
-                            isBullet = text.isBullet,
+                           // isBullet = text.isBullet,
                             underline = t1.underline,
                             italic = text.Italic,
                             bold = text.Bold,
-                            rot = this.rot,
-                            width = t1.width,
-                            pictureBullet = t1.PictureBullet,
-                            bulletSize = t1.bulletSize
+                           // rot = this.rot,
+                           // width = t1.width,
+                           // pictureBullet = t1.PictureBullet,
+                            //bulletSize = t1.bulletSize
                         }
                     });
+                    if (lineInMaxFontSize < text.FontSize) {
+                        lineInMaxFontSize = text.FontSize;
+                    }
                     processedElements.Add(t1);
                 }
+
+                paragraph.style.lnSpace = par.lnSpace();
+                paragraph.style.afSpace = par.afSpace();
+                paragraph.style.bfSpace = par.bfSpace();
                 fixLeftSpacingForAlignment(processedElements, par);
 
                 HtexText lastTxt = null;
@@ -353,7 +405,8 @@ namespace HTEXLib.Models.HTEX
                 paragraph.texts = texts;
                 Paragraphs.Add(paragraph);
             }
-            return Paragraphs;
+            textBody.paragraphs = Paragraphs;
+            return textBody;
         }
         private String getStringFromTextElements(List<HtexText> elements)
         {
@@ -483,7 +536,11 @@ namespace HTEXLib.Models.HTEX
             double bulletSize = 0;
             foreach (var text in list)
             {
-                float points = float.Parse(text.FontSize.ToString()) * 72.0F / 96.0F;
+                float points=0;
+                if (text.FontSize != 0)
+                {
+                    points = float.Parse(text.FontSize.ToString()) * 72.0F / 96.0F;
+                }
                 Font font = new System.Drawing.Font(text.FontFamily.ToString(), points);
                 if (text.Bold) font = new System.Drawing.Font(text.FontFamily.ToString(), points, System.Drawing.FontStyle.Bold);
                 else if (text.Italic) font = new System.Drawing.Font(text.FontFamily.ToString(), points, System.Drawing.FontStyle.Italic);
@@ -541,6 +598,10 @@ namespace HTEXLib.Models.HTEX
         }
         public static int MeasureString(string s, Font font)
         {
+            if (s.Equals("\t50"))
+            { 
+            
+            }// 四个&nbsp;
             s = s.Replace("\t", "aaaa");//TODO the replace is dirty hack for measuring tabulations
 
             StringFormat stringFormat = new StringFormat(StringFormat.GenericTypographic);

+ 138 - 34
HTEXLib/Models/HTEX/HtexTable.cs

@@ -79,9 +79,9 @@ namespace HTEXLib.Models.HTEX
                         }
                     }
                     td.style = cellStyle;
-                    LinkedList<PPTParagraph> PPTParagraphs = DoTextBody(cell.TextBody, slide.SlidePart, slide.shapeListStyleMaster, slide.shapeListStyleLayout);
-                    List<Paragraph> paragraphs = DrawText(PPTParagraphs);
-                    td.paragraphs = paragraphs;
+                    var ( PPTParagraphs,  tBody)  = DoTextBody(cell.TextBody, slide.SlidePart, slide.shapeListStyleMaster, slide.shapeListStyleLayout);
+                    TextBody textBody = DrawText(PPTParagraphs, tBody);
+                    td.textBody = textBody;
                     tr.td.Add(td);
                 }
                 trs.Add(tr);
@@ -89,13 +89,99 @@ namespace HTEXLib.Models.HTEX
             return trs;
         }
 
-        public List<Paragraph> DrawText(LinkedList<PPTParagraph> Texts)
+
+        private TextBody fillPropertiesFromMasterShape(DocumentFormat.OpenXml.Drawing.TextBody TxBody/*, bool isLayout, bool addListStyle*/ ,ref int fontScale , ref Int32 LineSpaceReduction)
+        {
+            TextBody textBody = new TextBody();
+            if (null != TxBody)
+            {
+            //    if (TxBody.ListStyle != null && addListStyle)
+            //    {
+            //        if (isLayout)
+            //            slide.shapeListStyleLayout = TxBody.ListStyle;
+            //        else
+            //            slide.shapeListStyleMaster = TxBody.ListStyle;
+            //    }
+                if (TxBody.BodyProperties != null && TxBody.BodyProperties.Anchor != null)
+                    textBody.anchor  = TxBody.BodyProperties.Anchor;
+                if (TxBody.BodyProperties.TopInset != null)
+                {
+                    textBody.top = System.Math.Round((double)TxBody.BodyProperties.TopInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties.BottomInset != null)
+                {
+                    textBody.bottom= System.Math.Round((double)TxBody.BodyProperties.BottomInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties.RightInset != null)
+                {
+                    textBody.right = System.Math.Round((double)TxBody.BodyProperties.RightInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties.LeftInset != null)
+                {
+                    textBody.left = System.Math.Round((double)TxBody.BodyProperties.LeftInset.Value * 1.0 / 12700, Globals.degree);
+                }
+                if (TxBody.BodyProperties != null &&
+                    TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>() != null && TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().FontScale != null)
+                {
+                    fontScale = TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().FontScale.Value;
+                }
+                if (TxBody.BodyProperties != null &&
+                    TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>() != null && TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().LineSpaceReduction != null)
+                {
+                    LineSpaceReduction = TxBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().LineSpaceReduction.Value;
+                }
+                if (TxBody.BodyProperties.AnchorCenter != null)
+                {
+                    textBody.anchorCtr = TxBody.BodyProperties.AnchorCenter;
+                }
+                if (TxBody.BodyProperties.RightToLeftColumns != null)
+                {
+                    textBody.rtlCol = TxBody.BodyProperties.RightToLeftColumns;
+                }
+                if (TxBody.BodyProperties.Wrap != null)
+                {
+                    textBody.wrap = TxBody.BodyProperties.Wrap;
+                }
+                if (TxBody.BodyProperties.Vertical != null)
+                {
+                    textBody.vert = TxBody.BodyProperties.Vertical;
+                }
+                if (TxBody.BodyProperties.Rotation != null)
+                {
+                    rot = TxBody.BodyProperties.Rotation.Value / 60000.0;
+                }
+                var elements = TxBody.BodyProperties.ChildElements;
+                foreach (var element in elements)
+                {
+                    if (element is NoAutoFit)
+                    {
+                        //此元素指定文本主体内的文本不应自动适合于边框。 自动拟合是当文本框内的文本被缩放以保持在文本框内时。
+                        textBody.autoFit = false;
+                    }
+                    if (element is NormalAutoFit normalAutoFit)
+                    {
+                        //每个形状的文本都停留在该形状的范围内
+                        textBody.autoFit = true;
+                        fontScale = normalAutoFit.FontScale != null ? normalAutoFit.FontScale.Value : 0;
+                    }
+                    if (element is ShapeAutoFit)
+                    {
+                        //每个形状的文本都停留在该形状的范围内。
+                        textBody.autoFit = true;
+                    }
+                    //TODO  3D Scene3DType  Shape3DType FlatText
+                }
+            }
+            return textBody;
+        }
+        public TextBody DrawText(LinkedList<PPTParagraph> Texts, TextBody  textBody)
         {
+            //TextBody textBody = new TextBody() { };
             List<Paragraph> Paragraphs = new List<Paragraph>();
             foreach (var par in Texts)
             {
                 double paragraphTop = par.getSpaceBeforePoints();
-                Paragraph paragraph = new HTEXLib.Paragraph { animatable = par.Animatable, invisible = par.Invisible };
+                Paragraph paragraph = new HTEXLib.Paragraph { /*animatable = par.Animatable, invisible = par.Invisible */};
                 paragraph.style.hori = par.Align;
                 if (par.bullet != null)
                 {
@@ -103,7 +189,7 @@ namespace HTEXLib.Models.HTEX
                     paragraph.buChar = new BuChar
                     {
                         type = bullet.BulletType,
-                        left = bullet.Left,
+                        //left = bullet.Left,
                         buchar = bullet.Text,
                         color = bullet.FontColor,
                         typeface = bullet.FontFamily,
@@ -168,28 +254,35 @@ namespace HTEXLib.Models.HTEX
                     }
                     t1.Text = text.Text;
                     textElements.Add(t1);
+                    RunStyle runStyle = PPTXHelper.DoRunProperties(text.runProp, slide, "text", partForm);
+                    if (runStyle.border != null && (runStyle.border.color.type == -1 || runStyle.border.color.type == 0))
+                    {
+                        runStyle.border.color = null;
+                    }
                     texts.Add(new Text
                     {
                         content = t1.Text,
                         link = text.link,
                         linkType = text.linkType,
                         style = new FontStyle
-                        {
+                        {   fill=runStyle.fill.type==-1|| runStyle.fill.type == 0? null:runStyle.fill,
+                            border=runStyle.border,
+                            effect = runStyle.effect,
                             align = par.FontAlign,
                             spacing = par.defTabSize,
                             color = text.FontColor,
                             family = text.FontFamily,
-                            top = top,
-                            left = left,
+                            //top = top,
+                           // left = left,
                             size = text.FontSize,
-                            isBullet = text.isBullet,
+                            //isBullet = text.isBullet,
                             underline = t1.underline,
                             italic = text.Italic,
                             bold = text.Bold,
-                            rot = this.rot,
-                            width = t1.width,
-                            pictureBullet = t1.PictureBullet,
-                            bulletSize = t1.bulletSize
+                           // rot = this.rot,
+                            //width = t1.width,
+                            //pictureBullet = t1.PictureBullet,
+                            //bulletSize = t1.bulletSize
                         }
                     });
                     processedElements.Add(t1);
@@ -218,7 +311,14 @@ namespace HTEXLib.Models.HTEX
                 paragraph.texts = texts;
                 Paragraphs.Add(paragraph);
             }
-            return Paragraphs;
+            if (textBody == null)
+            {
+                return null;
+            }
+            else {
+                textBody.paragraphs = Paragraphs;
+            }
+            return textBody;
         }
         private String getStringFromTextElements(List<HtexText> elements)
         {
@@ -389,30 +489,21 @@ namespace HTEXLib.Models.HTEX
             // 
             //             return result.ToSize();
         }
-        public LinkedList<PPTParagraph> DoTextBody(DocumentFormat.OpenXml.Drawing.TextBody TextBody, OpenXmlPart slidePart, ListStyle shapeListStyleMaster, ListStyle shapeListStyleLayout)
+        public (LinkedList<PPTParagraph> paragraphs, TextBody textBody) DoTextBody(DocumentFormat.OpenXml.Drawing.TextBody TextBody, OpenXmlPart slidePart, ListStyle shapeListStyleMaster, ListStyle shapeListStyleLayout)
         {
             LinkedList<PPTParagraph> Texts = new LinkedList<PPTParagraph>();
             bool IsText = true;
             int fontScale = 100000;
+            int LineSpaceReduction = 0;
             if (TextBody == null)
             {
                 IsText = false;
-                return null;
-            }
-            if (TextBody.BodyProperties != null)
-            {
-                if (TextBody.BodyProperties.Anchor != null)
-                {
-                    DocumentFormat.OpenXml.Drawing.TextAnchoringTypeValues VerticalAlign = TextBody.BodyProperties.Anchor;
-                }
-                if (TextBody.BodyProperties.GetFirstChild<NormalAutoFit>() != null &&
-                  TextBody.BodyProperties.GetFirstChild<NormalAutoFit>().FontScale != null)
-                {
-                    fontScale = TextBody.BodyProperties.GetFirstChild<NormalAutoFit>().FontScale.Value;
-                }
+                return (null,null);
             }
+            TextBody textBody = fillPropertiesFromMasterShape(TextBody,ref fontScale ,ref LineSpaceReduction);
             int index = 0;
-
+            int buIndex = 1;
+            BuChar buChar = new BuChar();
             foreach (var paragraph in TextBody.Descendants<DocumentFormat.OpenXml.Drawing.Paragraph>())
             {
                 PlaceholderShape placeholder = null;
@@ -428,8 +519,8 @@ namespace HTEXLib.Models.HTEX
                     par.Level = level;
                 }
 
-                par.SetParagraphProperties(paragraph, slidePart,
-                                           shapeListStyleMaster, shapeListStyleLayout);
+               par.SetParagraphProperties(paragraph, slidePart,
+                                           shapeListStyleMaster, shapeListStyleLayout,  buChar);
                 bool hasText = false;
                 foreach (var obj in paragraph.ChildElements)
                 {
@@ -439,13 +530,26 @@ namespace HTEXLib.Models.HTEX
                 //If we don't have text it still outputs the bullet character. 
                 if (par.bullet != null && hasText)
                 {
-                    par.RunPropList.Insert(0, par.bullet);
+                    par.bullet.FontSize = par.RunPropList[0].FontSize;
+                    par.bullet.FontColor = par.RunPropList[0].FontColor;
+                    par.bullet.bullIndex = buChar.index - 1;
+                    //   par.RunPropList.Insert(0, par.bullet);
+                }
+                else
+                {
+                    if (buChar != null)
+                    {
+                        buChar.index = 1;
+                    }
                 }
                 Texts.AddLast(par);
             }
-            return Texts;
+            return  (Texts, textBody);
         }
 
+
+
+
         private bool GetParagraphChildElements(DocumentFormat.OpenXml.Drawing.TextBody shape, PPTParagraph par, bool hasText, OpenXmlElement obj, int fontScale)
         {
             LinkedList<string> effectShapes = new LinkedList<string>();

+ 10 - 10
HTEXLib/Models/HTEX/HtexText.cs

@@ -45,7 +45,7 @@ namespace HTEXLib.Models.HTEX
             base.left = left;
             base.top = top;
             base.fontFamily = fontFamily;
-            this.isBullet = isBullet;
+           // this.isBullet = isBullet;
             base.fontColor = fontColor;
             this.bold = bold;
             this.italic = italic;
@@ -53,18 +53,18 @@ namespace HTEXLib.Models.HTEX
             this.slideIndex = slideIndex;
             base.partForm = partForm;
             ///TODO 字体贯穿线
-            ///  var FontStrik = node.GetTextByPath("a:rPr/@strike");
+            ///var FontStrik = node.GetTextByPath("a:rPr/@strike");
             ///var strikethrough = FontStrik != null ? FontStrik.Value : "noStrike";
             if (underline != null)
             {
-                if (underline.Equals("Single"))
-                {
-                    this.underline = "underline";
-                }
-                else if (underline.Equals("None"))
-                {
-                    this.underline = "none";
-                }
+                // if (underline.Equals("None"))
+                //{
+                //    this.underline = "none";
+                //}
+                //else {
+
+                //}
+                this.underline = underline;
             }
             else this.underline = "none";
         }

+ 149 - 76
HTEXLib/Models/PPTX/PPTParagraph.cs

@@ -20,7 +20,7 @@ namespace HTEXLib.Models.Inner
         public string Align { get; set; }//ctr, l, r, just, dist, thai, justLow
         public string FontAlign { get; set; }//auto, b, base, ctr, t
    
-        public Int32 Indent { get; set; }
+        public double Indent { get; set; }
         public Int32 Level { get; set; }
         public double marginLeft { get; set; }
         public double marginRight { get; set; }
@@ -52,17 +52,36 @@ namespace HTEXLib.Models.Inner
             RunPropList = new List<PPTRunProperties>();
         }
 
-
         public double getLineSpacingInPointsFromFont(double fontHeight)
         {
             if (lineSpacing == null)
-                return fontHeight;
+                return fontHeight ;
             if (lineSpacing.SpacingPoints != null)
-                return lineSpacing.SpacingPoints.Val;
+                return lineSpacing.SpacingPoints.Val * 1.0 / 100;
             if (lineSpacing.SpacingPercent != null)
-                return lineSpacing.SpacingPercent.Val * fontHeight*1.0 / Globals.PercentageConstant;
+                return lineSpacing.SpacingPercent.Val * fontHeight * 1.0 / Globals.PercentageConstant;
             return fontHeight;
         }
+        public Space lnSpace()
+        {
+            if (lineSpacing == null)
+                return new Space { type = "pct", val= 1.0 };
+            if (lineSpacing.SpacingPoints != null)
+                return new Space { type="pts",val = lineSpacing.SpacingPoints.Val * 1.0 / 100 };
+            if (lineSpacing.SpacingPercent != null)
+                return new Space { type = "pct", val = lineSpacing.SpacingPercent.Val * 1.0 / Globals.PercentageConstant };
+            return new Space { type = "pct", val = 1.0 };
+        }
+        //public double getLineSpacingInPointsFromFont(double fontHeight)
+        //{
+        //    if (lineSpacing == null)
+        //        return fontHeight;
+        //    if (lineSpacing.SpacingPoints != null)
+        //        return lineSpacing.SpacingPoints.Val*1.0/100;
+        //    if (lineSpacing.SpacingPercent != null)
+        //        return lineSpacing.SpacingPercent.Val * fontHeight*1.0 / Globals.PercentageConstant;
+        //    return fontHeight;
+        //}
         public double getSpaceBeforePoints()
         {
             return getSpacingInPoints(spaceBefore, 0);
@@ -76,6 +95,26 @@ namespace HTEXLib.Models.Inner
         {
             return getSpacingInPoints(spaceAfter, 0);
         }
+        public Space bfSpace()
+        {
+            if (spaceBefore == null)
+                return new Space { type = "pct", val = 0 };
+            if (spaceBefore.SpacingPoints != null)
+                return new Space { type = "pts", val = spaceBefore.SpacingPoints.Val * 1.0 / Globals.FontPoint };
+            if (spaceBefore.SpacingPercent.Val != null)
+                return new Space { type = "pct", val = spaceBefore.SpacingPercent.Val * 1.0 / Globals.PercentageConstant };
+            return new Space { type = "pct", val = 0 };
+        }
+        public Space afSpace()
+        {
+            if (spaceAfter == null)
+                return new Space {type= "pct", val=0};
+            if (spaceAfter.SpacingPoints != null)
+                return new Space { type = "pts", val = spaceAfter.SpacingPoints.Val * 1.0 / Globals.FontPoint };
+            if (spaceAfter.SpacingPercent.Val != null )
+                return new Space { type = "pct", val = spaceAfter.SpacingPercent.Val *1.0 / Globals.PercentageConstant };
+            return new Space { type = "pct", val = 0 };
+        }
         public double getSpaceAfterPoints(double height)
         {
             return getSpacingInPoints(spaceAfter, height);
@@ -94,7 +133,7 @@ namespace HTEXLib.Models.Inner
 
         public void SetParagraphProperties(DocumentFormat.OpenXml.Drawing.Paragraph paragraph, OpenXmlPart slidePart,
                         DocumentFormat.OpenXml.Drawing.ListStyle shapeListStyleMaster,
-                        DocumentFormat.OpenXml.Drawing.ListStyle shapeListStyleLayout)
+                        DocumentFormat.OpenXml.Drawing.ListStyle shapeListStyleLayout,  BuChar buChar)
         {
 
             TextListStyleType listStyleType = this.slide.defaultTextStyle;
@@ -122,22 +161,21 @@ namespace HTEXLib.Models.Inner
 
             defaultRunProperties = new PPTRunProperties(slide);
 
-
             if (baseProperties != null)
             {
-                this.FillParagraphProperties(baseProperties, slidePart);
+                 this.FillParagraphProperties(baseProperties, slidePart,  buChar);
             }
             if (basePropertiesMaster != null)
             {
-                this.FillParagraphProperties(basePropertiesMaster, slidePart);
+                this.FillParagraphProperties(basePropertiesMaster, slidePart,  buChar);
             }
             if (basePropertiesLayout != null)
             {
-                this.FillParagraphProperties(basePropertiesLayout, slidePart);
+                 this.FillParagraphProperties(basePropertiesLayout, slidePart ,buChar);
             }
             if (paragraph.ParagraphProperties != null)
             {
-                this.FillParagraphProperties(paragraph.ParagraphProperties, slidePart);
+               this.FillParagraphProperties(paragraph.ParagraphProperties, slidePart, buChar);
             }
         }
 
@@ -184,7 +222,7 @@ namespace HTEXLib.Models.Inner
         }
 
 
-        private void FillParagraphProperties(TextParagraphPropertiesType baseProperties, OpenXmlPart slidePart)
+        private void FillParagraphProperties(TextParagraphPropertiesType baseProperties, OpenXmlPart slidePart, BuChar buChar)
         {
             ///行距该元素指定段落中要使用的垂直行间距。可以用两种不同的方式来指定,百分比间距和字体点间距。如果省略此元素,则两行文本之间的间距应由一行中最大文本的点大小确定。
             ///<a:lnSpc>  
@@ -233,7 +271,7 @@ namespace HTEXLib.Models.Inner
                  * */
                 FontAlign = baseProperties.FontAlignment.Value.ToString();
             }
-https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textparagraphpropertiestype?view=openxml-2.8.1
+            https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textparagraphpropertiestype?view=openxml-2.8.1
             if (baseProperties.LeftMargin != null)
             {
                 marginLeft = baseProperties.LeftMargin.Value*1.0  / Globals.px12700;
@@ -245,14 +283,15 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
             //缩进
             if (baseProperties.Indent != null)
             {
-                Indent = baseProperties.Indent.Value / Globals.px12700;
+                Indent = baseProperties.Indent.Value *1.0 / Globals.px12700;
             }
-
-            defaultRunProperties.ReadDefaultRunProperties(baseProperties);
-            this.ReadBullets(baseProperties, slidePart);
+            
+            defaultRunProperties.ReadDefaultRunProperties(baseProperties );
+            this.ReadBullets(baseProperties, slidePart, buChar);
 
             if (baseProperties.GetFirstChild<NoBullet>() != null)
             {
+                buChar.index = 1;
                 bullet = null;
             }
             /// 指定标点符号是被强制地放置在一行文本上,还是放置在另一行文本上。
@@ -263,34 +302,45 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
             ///baseProperties.LatinLineBreak ,EastAsianLineBreak
             /// baseProperties.RightToLeft;
             ///baseProperties.DefaultTabSize;
-
+            ///
+           
         }
 
-        private void ReadBullets(TextParagraphPropertiesType baseProperties, OpenXmlPart slidePart)
+        private void ReadBullets(TextParagraphPropertiesType baseProperties, OpenXmlPart slidePart,  BuChar buChar)
         {
             var bulletProp = new PPTRunProperties(slide);
             bulletProp.isBullet = true;
-
             if (baseProperties != null)
             {
                 if (baseProperties.GetFirstChild<CharacterBullet>() != null)
                 {
-                    this.ReadCharacterBullets(baseProperties, bulletProp);
+                    this.ReadCharacterBullets(baseProperties, bulletProp, buChar);
+
                 }
                 else if (baseProperties.GetFirstChild<PictureBullet>() != null)
                 {
-                    this.ReadPictureBullets(baseProperties, bulletProp, slidePart);
+                    this.ReadPictureBullets(baseProperties, bulletProp, slidePart, buChar);
+
                 }
-                else if (baseProperties.GetFirstChild<AutoNumberedBullet>() != null) {
-                    this.ReadAutoNumberedBullet(baseProperties, bulletProp);
+                else if (baseProperties.GetFirstChild<AutoNumberedBullet>() != null)
+                {
+                    this.ReadAutoNumberedBullet(baseProperties, bulletProp, buChar);
+
                 }
             }
+            else { buChar.index = 1; }
+            if (buChar != null && buChar.type == null && baseProperties!=null)
+            {
+                buChar.type = bulletProp.BulletType;
+                buChar.size = bulletProp.bulletSize;
+                buChar.buchar = bulletProp.Text;
+            }
         }
 
       
-        private void ReadPictureBullets(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp, OpenXmlPart slidePart)
+        private void ReadPictureBullets(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp, OpenXmlPart slidePart, BuChar buChar)
         {   //TODO  获取段落的Bullet  大纲 提纲符号
-            this.SetBulletProperties(baseProperties, bulletProp);
+            this.SetBulletProperties(baseProperties, bulletProp,buChar);
             var picBul = baseProperties.GetFirstChild<PictureBullet>();
             if (picBul != null)
             {
@@ -322,16 +372,17 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
                 }
             }
         }
-        public void ReadAutoNumberedBullet(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp)
+        public void ReadAutoNumberedBullet(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp, BuChar buChar)
         {
            
             string text ="";
             AutoNumberedBullet autoNumberedBullet = baseProperties.GetFirstChild<AutoNumberedBullet>();
-            int num = Paragraph + 1;
+            int num = buChar.index;
             if (autoNumberedBullet.StartAt != null)
             {
-                num = autoNumberedBullet.StartAt.Value + (Paragraph+1 - 1);
+                num = autoNumberedBullet.StartAt.Value + buChar.index;
             }
+            buChar.index += 1;
             switch (autoNumberedBullet.Type.Value) {
                 case
                     TextAutoNumberSchemeValues.AlphaLowerCharacterParenBoth:
@@ -360,7 +411,7 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
                     break;
                 case
                     TextAutoNumberSchemeValues.AlphaUpperCharacterPeriod:
-                    text = "(" + BulletAutonumberHelper.IntToChar(num, true) + ".";
+                    text = BulletAutonumberHelper.IntToChar(num, true) + ".";
                     //A., B., C., …
                     break;
                 case
@@ -399,7 +450,7 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
                     break;
                 case
                     TextAutoNumberSchemeValues.RomanLowerCharacterPeriod:
-                    text = "(" + BulletAutonumberHelper.IntToRoman(num, false) + ".";
+                    text =  BulletAutonumberHelper.IntToRoman(num, false) + ".";
                     //i., ii., iii., …
                     break;
                 case
@@ -467,41 +518,40 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
             //大纲符号 自动编号类型
             bulletProp.BulletType = "AutoNum";
             bulletProp.Text = text;
-            var bufont = baseProperties.GetFirstChild<BulletFont>();
-            if (baseProperties.GetFirstChild<BulletFont>() != null)
-            {
-                bulletProp.bulletSize = bufont.PitchFamily;
-                bulletProp.FontFamily = bufont.Typeface;
-            }
-            this.SetBulletProperties(baseProperties, bulletProp);
+            //var bufont = baseProperties.GetFirstChild<BulletFont>();
+            //if (baseProperties.GetFirstChild<BulletFont>() != null)
+            //{
+            //    bulletProp.bulletSize = bufont.PitchFamily!=null? bufont.PitchFamily.Value:12;
+            //    bulletProp.FontFamily = bufont.Typeface;
+
+            //}
+            this.SetBulletProperties(baseProperties, bulletProp,buChar );
         }
 
-        private void ReadCharacterBullets(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp)
+        private void ReadCharacterBullets(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp,BuChar buChar )
         {
             bulletProp.BulletType = "Character";
             // BulletFontText   此元素指定段落的符号的字体应与包含每个符号的文本相同。
             //<a:buFont typeface="Arial" panose="020B0604020202020204" pitchFamily="34" charset="0" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" />
             bulletProp.Text = "" + baseProperties.GetFirstChild<CharacterBullet>().Char;
-            var bufont = baseProperties.GetFirstChild<BulletFont>();
-            if (baseProperties.GetFirstChild<BulletFont>() != null) {
-                bulletProp.bulletSize = bufont.PitchFamily;
-                bulletProp.FontFamily = bufont.Typeface;
-            }
-            this.SetBulletProperties(baseProperties, bulletProp);
+            
+            //ReadBulletFont(baseProperties, bulletProp);
+          
+            this.SetBulletProperties(baseProperties, bulletProp, buChar);
         }
 
-        private void SetBulletProperties(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp)
+        private void SetBulletProperties(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp,BuChar buChar )
         {
             //  BulletSizeText  可忽略 此元素指定段落的符号大小应与包含每个符号的文本相同。
             this.ReadBulletFont(baseProperties, bulletProp);
-            this.ReadBulletColor(baseProperties, bulletProp);
-            this.ReadBulletSizePercentage(baseProperties, bulletProp);
+            this.ReadBulletColor(baseProperties, bulletProp,buChar);
+            this.ReadBulletSizePercentage(baseProperties, bulletProp,buChar);
             bulletProp.Left = marginLeft;
             bullet = bulletProp;
 
         }
 
-        private void ReadBulletColor(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp)
+        private void ReadBulletColor(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp, BuChar buChar)
         {
             //BulletColorText 指定Bullet的文本颜色与正文的颜色相同 可忽略不处理
             BulletColor buCol = baseProperties.GetFirstChild<BulletColor>();
@@ -521,6 +571,9 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
                 //    }
                 //}
             }
+            if (!string.IsNullOrEmpty(buChar.color)) {
+                bulletProp.FontColor = buChar.color;
+            }
         }
 
         private void ReadBulletFont(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp)
@@ -534,50 +587,70 @@ https://docs.microsoft.com/zh-cn/dotnet/api/documentformat.openxml.drawing.textp
                 {
                     bulletProp.FontSize = font.PitchFamily;
                 }
-                else
-                {
-                    var latinFonts = font.GetFirstChild<LatinFont>();
-                    var EastAsianFont = font.GetFirstChild<EastAsianFont>();
-                    var ComplexScriptFont = font.GetFirstChild<ComplexScriptFont>();
-                    if (latinFonts != null)
-                    {
-                        bulletProp.ReadFontFamilyFromTheme(latinFonts);
-                    }
-                    if (EastAsianFont != null) {
-                        bulletProp.ReadFontFamilyFromTheme(EastAsianFont);
-                    }
-                    if (ComplexScriptFont != null)
-                    {
-                        bulletProp.ReadFontFamilyFromTheme(ComplexScriptFont);
-                    }
-                }
+                bulletProp.ReadFontFamilyFromTheme(font);
             }
             else
             {
-                bulletProp.FontSize = defaultRunProperties.FontSize;
+                bulletProp.FontFamily = defaultRunProperties.FontFamily;
             }
         }
 
-        private void ReadBulletSizePercentage(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp)
+        private void ReadBulletSizePercentage(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp, BuChar buChar)
         {
             if (baseProperties.GetFirstChild<BulletSizePercentage>() != null)
             {
                 BulletSizePercentage pct = baseProperties.GetFirstChild<BulletSizePercentage>();
-                if (bulletProp.bulletSize != 0)
+                if (pct != null && pct.Val != 0)
+                {
+                    //0.95 95% 
+                    bulletProp.bulletPct = pct.Val * 1.0 / Globals.PercentageConstant;
+                   // bulletProp.FontSize = System.Math.Round(pct.Val * 1.0 / 10000, Globals.degree);
+                   
+                }
+                //else
+                //{
+                //    if (buChar != null)
+                //    {
+                //      //  bulletProp.bulletSize = buChar.size;
+                //       // bulletProp.FontSize = buChar.size;
+                //        // 
+                //    }
+                //    else {
+                //        bulletProp.FontSize = Globals.DefaultBulletSize;
+                //        bulletProp.bulletSize = Globals.DefaultBulletSize;
+                //    }
+                //   // bulletProp.bulletSize = Globals.DefaultBulletSize;
+                //   // bulletProp.FontSize = Globals.DefaultBulletSize;
+                //    // bulletProp.bulletSize = bulletProp.bulletSize * pct.Val * 1.0 / Globals.PercentageConstant;
+                //}
+            }
+            if (baseProperties.GetFirstChild<BulletSizePoints>() != null)
+            {
+                BulletSizePoints bulletSizePoints = baseProperties.GetFirstChild<BulletSizePoints>();
+                if (bulletSizePoints.Val != null)
                 {
-                    bulletProp.bulletSize = bulletProp.bulletSize * pct.Val *1.0/ Globals.PercentageConstant;
+                    bulletProp.bulletSize = bulletSizePoints.Val * 1.0 / 100;
+                    bulletProp.FontSize = bulletSizePoints.Val * 1.0 / 100;
                 }
                 else
                 {
-                    bulletProp.bulletSize = Globals.DefaultBulletSize;
-                    bulletProp.bulletSize = bulletProp.bulletSize * pct.Val * 1.0 / Globals.PercentageConstant;
+                    if (buChar != null)
+                    {
+                        bulletProp.bulletSize = buChar.size;
+                        bulletProp.FontSize = buChar.size;
+                        // bulletProp.FontSize = Globals.DefaultBulletSize;
+                    }
                 }
             }
-            if (baseProperties.GetFirstChild<BulletSizePoints>() != null) {
-                BulletSizePoints bulletSizePoints= baseProperties.GetFirstChild<BulletSizePoints>();
-                if (bulletSizePoints.Val != null) {
-                    bulletProp.bulletSize = bulletSizePoints.Val * 1.0 / 100;
+            else 
+            {
+                if (buChar != null)
+                {
+                    bulletProp.bulletSize = buChar.size;
+                    bulletProp.FontSize = buChar.size;
+                    // bulletProp.FontSize = Globals.DefaultBulletSize;
                 }
+                // bulletProp.FontSize = Globals.DefaultBulletSize;
             }
         }
 

+ 8 - 3
HTEXLib/Models/PPTX/PPTRunProperties.cs

@@ -31,16 +31,18 @@ namespace HTEXLib.Models.Inner
         public bool isBullet { get; set; }
         public string BulletType { get; set; }
         public double bulletSize { get; set; }
+        public double bulletPct { get; set; } = 0;
+        public int bullIndex { get; set; }
         public string link { get; set; }
         public string linkType { get; set; }
         public PPTSlide slide { get; set; }
-
+        public TextCharacterPropertiesType runProp { get; set; }
         public PPTRunProperties(PPTSlide slide)
         {
             //Default Fonts
             this.slide = slide;
             this.FontFamily = "Calibri";
-            this.FontSize = 32;
+           // this.FontSize = 32;
             this.Bold = false;
             this.Italic = false;
             this.FontColor =null;
@@ -73,6 +75,7 @@ namespace HTEXLib.Models.Inner
         {
             if (runProperties != null)
             {
+                runProp = runProperties;
                 EffectList effects = runProperties.GetFirstChild<EffectList>();
                 GradientFill gradient = runProperties.GetFirstChild<GradientFill>();
 
@@ -112,7 +115,7 @@ namespace HTEXLib.Models.Inner
                 {
                     Spacing = runProperties.Spacing.Value;
                 }
-
+                
                 var coplexScriptFonts = runProperties.Descendants<ComplexScriptFont>();
                 var latinFonts = runProperties.GetFirstChild<LatinFont>();
                 var EastAsianFont = runProperties.GetFirstChild<EastAsianFont>();
@@ -173,6 +176,7 @@ namespace HTEXLib.Models.Inner
         {
             if (runProperties != null)
             {
+                runProp = runProperties;
                 EffectList effects = runProperties.GetFirstChild<EffectList>();
                 GradientFill gradient = runProperties.GetFirstChild<GradientFill>();
 
@@ -270,6 +274,7 @@ namespace HTEXLib.Models.Inner
         {
             if (runProperties != null)
             {
+                runProp = runProperties;
                 EffectList effects = runProperties.GetFirstChild<EffectList>();
                 GradientFill gradient = runProperties.GetFirstChild<GradientFill>();
 

+ 26 - 7
HTEXLib/Models/PPTX/PPTShape.cs

@@ -80,8 +80,7 @@ namespace HTEXLib.Models.Inner
             var nonVisualShapeProp = new PPTNonVisualShapeProp
             {
                 TimingId = shape.NonVisualShapeProperties.NonVisualDrawingProperties.Id,
-                Id = PartForm + "PPTShape" +
-                                                  shape.NonVisualShapeProperties.NonVisualDrawingProperties.Id,
+                Id = PartForm + "PPTShape" + shape.NonVisualShapeProperties.NonVisualDrawingProperties.Id,
                 Name = shape.LocalName,
                 Type = "PPTShape"
             };
@@ -234,6 +233,8 @@ namespace HTEXLib.Models.Inner
                 shapeListStyleSlide = shape.TextBody.ListStyle;
             }
             int index = 0;
+           
+            BuChar buChar= new BuChar() { index=1};
             foreach (var paragraph in shape.TextBody.Descendants<DocumentFormat.OpenXml.Drawing.Paragraph>())
             {
                 var par = new PPTParagraph(slide, placeholder,PartForm)
@@ -249,7 +250,7 @@ namespace HTEXLib.Models.Inner
                 }
 
                 par.SetParagraphProperties(paragraph, slidePart,
-                                           shapeListStyleMaster, shapeListStyleLayout);
+                                           shapeListStyleMaster, shapeListStyleLayout,  buChar);
                 bool hasText = false;
                 foreach (var obj in paragraph.ChildElements)
                 {
@@ -259,7 +260,17 @@ namespace HTEXLib.Models.Inner
                 //If we don't have text it still outputs the bullet character. 
                 if (par.bullet != null && hasText)
                 {
-                    par.RunPropList.Insert(0, par.bullet);
+                    par.bullet.FontSize = par.RunPropList[0].FontSize;
+                    par.bullet.FontColor = par.RunPropList[0].FontColor;
+                    par.bullet.bullIndex = buChar.index-1;
+                    //   par.RunPropList.Insert(0, par.bullet);
+                }
+                else
+                {
+                    if (buChar != null)
+                    {
+                        buChar.index = 1;
+                    }
                 }
                 Texts.AddLast(par);
             }
@@ -281,7 +292,9 @@ namespace HTEXLib.Models.Inner
                 }
                 runProp.Text = run.Text.Text;
                 runProp.SetRunProperties(run.RunProperties, shape, ref effectShapes);
-                runProp.FontSize = System.Math.Round(fontScale * runProp.FontSize / Globals.PercentageConstant, Globals.degree);
+                if (fontScale != 0) {
+                    runProp.FontSize = System.Math.Round(fontScale * runProp.FontSize / Globals.PercentageConstant, Globals.degree);
+                }
                 par.RunPropList.Add(runProp);
             }
 
@@ -296,7 +309,10 @@ namespace HTEXLib.Models.Inner
                 }
                 runProp.Text = run.Text.Text;
                 runProp.SetRunProperties(run.RunProperties, shape, ref effectShapes);
-                runProp.FontSize =System. Math.Round(fontScale * runProp.FontSize / Globals.PercentageConstant, Globals.degree);
+                if (fontScale != 0)
+                {
+                    runProp.FontSize = System.Math.Round(fontScale * runProp.FontSize / Globals.PercentageConstant, Globals.degree);
+                }
                 par.RunPropList.Add(runProp);
             }
 
@@ -305,7 +321,10 @@ namespace HTEXLib.Models.Inner
                 Break aBreak = (Break)obj;
                 PPTRunProperties runProp = new PPTRunProperties(par.defaultRunProperties);
                 runProp.SetRunProperties(aBreak.RunProperties, shape, ref effectShapes);
-                runProp.FontSize =System. Math.Round(fontScale * runProp.FontSize / Globals.PercentageConstant, Globals.degree);
+                if (fontScale != 0)
+                {
+                    runProp.FontSize = System.Math.Round(fontScale * runProp.FontSize / Globals.PercentageConstant, Globals.degree);
+                }
                 runProp.isBreak = true;
                 par.RunPropList.Add(runProp);
             }

+ 9 - 2
HTEXLib/Models/PPTX/PPTShapeBase.cs

@@ -40,7 +40,7 @@ namespace HTEXLib.Models.Inner
         /// 单页PPT
         /// </summary>
         public PPTSlide slide { get; set; }
-       
+        public DocumentFormat.OpenXml.Int32Value LineSpaceReduction { get; set; }
         /// <summary>
         /// 所有的多媒体Base64
         /// </summary>
@@ -205,7 +205,14 @@ namespace HTEXLib.Models.Inner
                 }
                 if (masterShape.TextBody.BodyProperties != null &&
                     masterShape.TextBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>() != null && masterShape.TextBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().FontScale != null)
+                {
                     fontScale = masterShape.TextBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().FontScale.Value;
+                }
+                if (masterShape.TextBody.BodyProperties != null &&
+                    masterShape.TextBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>() != null && masterShape.TextBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().LineSpaceReduction != null)
+                {
+                    LineSpaceReduction = masterShape.TextBody.BodyProperties.GetFirstChild<DocumentFormat.OpenXml.Drawing.NormalAutoFit>().LineSpaceReduction.Value;
+                }
 
                 if (masterShape.TextBody.BodyProperties.AnchorCenter != null)
                 {
@@ -239,7 +246,7 @@ namespace HTEXLib.Models.Inner
                     {
                         //每个形状的文本都停留在该形状的范围内
                         autoFit = true;
-                        fontScale = normalAutoFit.FontScale.Value;
+                        fontScale = normalAutoFit.FontScale!=null?normalAutoFit.FontScale.Value:0;
                     }
                     if (element is ShapeAutoFit)
                     {

+ 44 - 8
HTEXLib/Models/Paragraph.cs

@@ -8,7 +8,7 @@ namespace HTEXLib
     public class Paragraph
     {
 
-        
+
         public Paragraph() {
             texts = new List<Text>();
         }
@@ -19,17 +19,26 @@ namespace HTEXLib
         /// <summary>
         /// 是否有动画
         /// </summary>
-        public bool animatable { get; set; }
+        //public bool animatable { get; set; }
         public BuChar buChar { get; set; }
         public List<Text> texts { get; set; }
         /// <summary>
         /// 进入场景之前是否可见元素
         /// </summary>
-        public bool invisible { get; set; }
+       // public bool invisible { get; set; }
+    }
+    public abstract class Richtext{
+        public string type { get; set; }
     }
-    public class Text //:Item
+
+    public class Attach: Richtext
+    { 
+
+    }
+    public class Text : Richtext
     {
-      //  public string StyleSha { get; set; }
+        public string type { get; set; } = "text";
+        //  public string StyleSha { get; set; }
         public string content { get; set; }
         public string link { get; set; }
         public string linkType { get; set; }
@@ -41,12 +50,13 @@ namespace HTEXLib
     public class BuChar {
         //TYPE_BULPIC  TYPE_NUMERIC TYPE_BULLET  TYPE_NONE  没有图标的 只有缩进
         public string type{ get; set; }
-        public double left { get; set; }
+       // public double left { get; set; }
        // public double riht { get; set; }
         public string buchar { get; set; }
         public string color { get; set; }
         public string typeface { get; set; }
         public double  size { get; set; }
+        public int index { get; set; }
        // public string @float { get; set; }
         /// <summary>
         /// ltr	默认。文本方向从左到右
@@ -58,6 +68,15 @@ namespace HTEXLib
 
     public class ParagraphStyle
     {
+        //public double top { get; set; }
+        //public double bottom { get; set; }
+        //public double left { get; set; }
+        //public double  right{ get; set; }
+
+        /// <summary>
+        /// 缩进
+        /// </summary>
+        public double indent { get; set; } = 0;
         /// <summary>
         /// 垂直方向
         /// </summary>
@@ -105,10 +124,27 @@ namespace HTEXLib
         ///     When the item is serialized out as xml, its value is "wordArtVertRtl".
         /// WordArtLeftToRight = 6
         /// </summary>
-        public string writing { get; set; }
-        public Position position { get; set; } = new Position();
+        ///  public string writing { get; set; }
+        /// public Position position { get; set; } = new Position();
 
+        /// <summary>
+        /// 行间距离  计算text最大值的高度距离
+        /// </summary>
+        public Space lnSpace { get; set; }
+        /// <summary>
+        /// 段前距离  计算text最大值的高度距离
+        /// </summary>
+        public Space bfSpace { get; set; }
+        /// <summary>
+        /// 段后距离  计算text最大值的高度距离
+        /// </summary>
+        public Space afSpace { get; set; }
         //public double newTop { get; set; }
+        
+    }
 
+    public class Space {
+        public string type { get; set; }
+        public double val { get; set; }
     }
 }

+ 1 - 1
HTEXLib/Models/Question.cs

@@ -7,7 +7,7 @@ namespace HTEXLib.Models
 {
     public class Question :Item
     {
-        public new  string type = "Question";
+        public new  string type = "Html";
         //题干
         [Required(ErrorMessage = "{0} 必须填写")]
         public string question { get; set; }

+ 1 - 1
HTEXLib/Models/Shape.cs

@@ -7,7 +7,7 @@ namespace HTEXLib
      public class Shape : Item
     { 
         public string shapeType;
-        public List<Paragraph> paragraph { get; set; }
+        public TextBody textBody { get; set; }
         public HTEXLib.Models.HTEX.ShapeStyle style { get; set; } = new Models.HTEX.ShapeStyle();
 
         //public List<ShapeGuide> ShapeGuides { get; set; }

+ 110 - 3
HTEXLib/Models/ShapeStyle.cs

@@ -4,13 +4,120 @@ using System.Text;
 
 namespace HTEXLib.Models.HTEX
 {
-    public  class ShapeStyle
-    { 
+    public class ShapeStyle
+    {
         /// <summary>
         /// 坐标信息
         /// </summary>
         public Position position { get; set; }
         public Border border { get; set; } = new Border();
-        public Fill fill { get; set; } = new Fill() { type=-1};
+        public Fill fill { get; set; } = new Fill() { type = -1 };
+        public Effect effect{ get; set; }
+    }
+    public class RunStyle
+    {
+        public Border border { get; set; } = new Border();
+        public Fill fill { get; set; } = new Fill() { type = -1 };
+        public Effect effect { get; set; }
+    }
+
+    public class Effect{
+        /// <summary>
+        /// blur,fillOverlay,glow,innerShdw,outerShdw,prstShdw,reflection,softEdge
+        /// </summary>
+
+        public Blur blur { get; set; }
+        public FillOverlay fillOverlay { get; set; }
+        //发光
+        public Glow glow { get; set; }
+        public InnerShadow innerShadow { get; set; }
+        public OuterShadow outerShadow { get; set; }
+        public PresetShadow presetShadow { get; set; }
+        public Reflection reflection { get; set; }
+        public SoftEdge softEdge { get; set; }
+    }
+    public class Blur {
+        //public new string type { get; set; } = "blur";
+
+        public double radius { get; set; }
+        public bool grow { get; set; }
+    }
+    public class FillOverlay 
+    {
+        //public new string type { get; set; } = "fillOverlay";
+        public Fill fill { get; set; }
+        public string blend { get; set; }
+    }
+    public class Glow 
+    {
+      //  public new string type { get; set; } = "glow";
+        public string color { get; set; }
+        //pt 磅
+        public double rad { get; set; }
+    }
+    public class InnerShadow 
+    {
+      //  public new string type { get; set; } = "innerShdw";
+        public double blurRad { get; set; }
+        public double dist { get; set; }
+        public double dir { get; set; }
+        public string color { get; set; }
+    }
+    public class OuterShadow 
+    {
+        //public new string type { get; set; } = "outerShdw";
+        //模糊
+        public double blurRad { get; set; }
+        //距离
+        public double dist { get; set; }
+        //角度
+        public double dir { get; set; }
+        public string color { get; set; }
+        public bool rotWithShape { get; set; }
+        public string algn { get; set; }
+        public double ky { get; set; }
+        public double sy { get; set; }
+        public double sx { get; set; }
+        public double kx { get; set; }
+    }
+    public class PresetShadow 
+    {
+        //public new string type { get; set; } = "prstShdw";
+        public  string prst { get; set; } 
+        public double dist { get; set; }
+        public double dir { get; set; }
+        public string color { get; set; }
+    }
+    //映像
+    public class Reflection 
+    {
+       // public new string type { get; set; } = "reflection";
+        //模糊
+        public double blurRad { get; set; }
+        //距离
+        public double dist { get; set; }
+        public double dir { get; set; }
+        public bool rotWithShape { get; set; }
+        public string algn { get; set; }
+        public double ky { get; set; }
+        public double sy { get; set; }
+        public double sx { get; set; }
+        public double kx { get; set; }
+        //透明度0-1  透明-不透明
+        public double stA { get; set; }
+        public double stPos { get; set; }
+        public double endA { get; set; }
+        //大小
+        public double endPos { get; set; }
+        public double fadeDir { get; set; }
+
+    }
+    /// <summary>
+    /// 柔化边缘
+    /// </summary>
+    public class SoftEdge 
+    {
+       // public new string type { get; set; } = "softEdge";
+        public double rad { get; set; }
     }
 }

+ 1 - 1
HTEXLib/Models/Table.cs

@@ -42,7 +42,7 @@ namespace HTEXLib
 
         public bool vmerge { get; set; }
         public bool hmerge { get; set; }
-        public List<Paragraph> paragraphs { get; set; }
+        public TextBody textBody { get; set; }
 
     }
 

+ 9 - 4
HTEXLib/Models/TextBody.cs

@@ -2,11 +2,11 @@ using System;
 using System.Collections.Generic;
 using System.Text;
 
-namespace HTEXLib.Models
+namespace HTEXLib
 {
     public  class TextBody
     {
-        public List<Paragraph> paragraph { get; set; }
+        public List<Paragraph> paragraphs { get; set; }
         /// <summary>
         /// 垂直布局 Top 0,Center 1 , Bootom 2
         /// </summary>
@@ -14,9 +14,9 @@ namespace HTEXLib.Models
         /// <summary>
         /// 水平布局 水平居中anchorCt
         /// </summary>
-        public string anchorCtr { get; set; }
+        public bool anchorCtr { get; set; }
         // 书写方向 false 从左到右书写,true从右到左
-        bool rtlCol { get; set; }
+        public  bool rtlCol { get; set; }
         /// <summary>
         /// square 不溢出, none 溢出
         /// </summary>
@@ -51,5 +51,10 @@ namespace HTEXLib.Models
         /// flase 此元素指定文本主体内的文本不应自动适合于边框。
         /// </summary>
         public bool autoFit { get; set; } = true;
+        public double top { get; set; }
+        public double bottom { get; set; }
+        public double left { get; set; }
+        public double right { get; set; }
+        public double lnSpRn { get; set; } = 0;
     }
 }

+ 13 - 13
HTEXTest/Program.cs

@@ -55,19 +55,19 @@ namespace HTEXTest
 
         static void Main(string[] args)
         {
-            Console.WriteLine(BulletAutonumberHelper.LongToText(10));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(11));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(20));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(21));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(99));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(100));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(101));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(999));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(1000));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(1001));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(1101));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(10101));
-            Console.WriteLine(BulletAutonumberHelper.LongToText(10000));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(10));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(11));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(20));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(21));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(99));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(100));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(101));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(999));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(1000));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(1001));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(1101));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(10101));
+            //Console.WriteLine(BulletAutonumberHelper.LongToText(10000));
             Console.WriteLine(BulletAutonumberHelper.IntToCircle(15, true));
             Console.WriteLine( BulletAutonumberHelper.IntToRoman(12, true));
             Console.WriteLine(BulletAutonumberHelper.IntToRoman(27, true));