CrazyIter 4 tahun lalu
induk
melakukan
355643722c

+ 0 - 2
HTEXLib/Builders/HtexBuilder.cs

@@ -153,7 +153,6 @@ namespace HTEXLib.Builders
                         slideMaster = slideMasterPart;
                     }
                 }
-              //  Console.WriteLine(slidePart.SlideLayoutPart.Uri.ToString());
                 if (slideIndex > 1 && slidePart.Slide.Transition != null && slidePart.Slide.Transition.AdvanceAfterTime != null)
                 {
                     pptSlides[pptSlides.Count - 1].advanceAfterTime = int.Parse(slidePart.Slide.Transition.AdvanceAfterTime.Value);
@@ -182,7 +181,6 @@ namespace HTEXLib.Builders
                         try
                         {
                             SlidePart slidePart = (SlidePart)presentationPart.GetPartById(slideId.RelationshipId);
-                            Console.WriteLine(slidePart.SlideLayoutPart.Uri);
                             slideParts.Add(slidePart);
                         }
                         catch (Exception ex)

+ 1 - 7
HTEXLib/Builders/PPTBackgroundBuilderInterop.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.IO;
 using System.Runtime.InteropServices;
 
@@ -60,7 +60,6 @@ namespace HTEXLib.Builders
             //}
             //catch (InvalidComObjectException ex)
             //{
-            //    Console.WriteLine(ex.Message);
             //}
         }
 
@@ -105,7 +104,6 @@ namespace HTEXLib.Builders
             //    {
             //        Microsoft.Office.Interop.PowerPoint.Shape shape = slide.Shapes[shapeIndex];
             //        fileAddress = string.Concat(newExportDir, "\\s", SLIDE_NUMBER, "s", shape.Id);
-            //        // Console.WriteLine("Shape id is:"+shape.Id);
 
             //        ExportShapeByType(fileAddress, shape, slideIndex);
             //    }
@@ -153,7 +151,6 @@ namespace HTEXLib.Builders
             }
             catch (IOException iex)
             {
-                Console.WriteLine(iex.Message);
             }
             return path;
         }
@@ -201,7 +198,6 @@ namespace HTEXLib.Builders
         private void ExportShapeByType(string fileAddress, object shape,
                                        int slideIndex)
         {
-            //Console.WriteLine("The hape type is:"+shape.Type);
 
             //switch (shape.Type)
             //{
@@ -212,7 +208,6 @@ namespace HTEXLib.Builders
             //        }
             //        catch (System.Reflection.TargetInvocationException ex)
             //        {
-            //            Console.WriteLine(ex.Message);
             //        }
             //        break;
             //    case Microsoft.Office.Core.MsoShapeType.msoSmartArt:
@@ -239,7 +234,6 @@ namespace HTEXLib.Builders
             //        }
             //        catch (System.Reflection.TargetInvocationException ex)
             //        {
-            //            Console.WriteLine(ex.Message);
             //        }
             //        break;
             //}

+ 31 - 2
HTEXLib/Controller/HtexController.cs

@@ -161,7 +161,6 @@ namespace HTEXLib.Controller
                 };
                 string anima = new JSONGenerator(_mSlide).GetAnimaVariable();
                 //if (_mSlide.slideIndex == 27) {
-                //    Console.WriteLine(_mSlide.slideIndex);
                 //}
               
                 Slide slide = new Slide();
@@ -184,12 +183,42 @@ namespace HTEXLib.Controller
                     slide.fill = PPTXHelper.DoBackgroundProperties(background.BackgroundProperties, _mSlide, "master");
                 };
                 htexElements.AddRange(htexSlide.DrawElement());
+
+
+
+                List<Group> newGroup = new List<Group>();
+                //处理组合图形在Wpf不能多层嵌套
+
+                int len = htexElements.Count;
+                for (int i =0;i<len;i++)
+                {
+                    if (htexElements[i] is Group group)
+                    {
+                        doGroup(group, newGroup);
+                    }
+                }
                 slide.item = htexElements;
                 return slide;
             }
             else { return null; }
         }
+        public void doGroup(Group group, List<Group> newGroup)
+        {
+            if (group != null && group.shapes != null && group.shapes.Count > 0)
+            {
+                newGroup.Add(group);
+                int len = group.shapes.Count;
+                for(int i= 0; i < len;i++ ){
+                    if (group.shapes[i] is Group gp)
+                    {
+                        //深拷贝操作
+                      //  var gg= gp.ToJson().FromJson<Group>();
+                        doGroup(gp, newGroup);
+                       
+                    }
+                }
+            }
+        }
 
-       
     }
 }

+ 0 - 5
HTEXLib/Helpers/ColorHelpers/ColorConverter.cs

@@ -166,7 +166,6 @@ namespace HTEXLib
         }
         public string SetShade(Color c, double shade)
         {
-            //Console.WriteLine("Shade: " + shade);
 
             double convShade = (shade / 1000) * 0.01;
 
@@ -178,7 +177,6 @@ namespace HTEXLib
             double gLin = RGB_to_linearRGB(g);
             double bLin = RGB_to_linearRGB(b);
 
-            //Console.WriteLine("Linear R: " + rLin + "\nLinear G: " + gLin + "\nLinear B: " + bLin);
 
             //SHADE 
             if ((rLin * convShade) < 0)
@@ -442,17 +440,14 @@ namespace HTEXLib
             if (rBool)
             {
                 H = ((G - B) / (max - min)) * 60.0;
-                Console.WriteLine("red");
             }
             if (gBool)
             {
                 H = ((2.0 + ((B - R) / (max - min))) * 60.0);
-                Console.WriteLine("green");
             }
             if (bBool)
             {
                 H = (4.0 + (R - G) / (max - min)) * 60.0;
-                Console.WriteLine("blue");
             }
 
             if (H < 0)

+ 4 - 4
HTEXLib/Helpers/ShapeHelpers/PPTXHelper.cs

@@ -291,7 +291,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 }
             }
             TbStyle tbStyle =DoTableStyle(TableStyle,slide,type,partForm);
-            if (fill != null &&  fill.type == -1)
+            if (fill != null )
             {
                 tbStyle.fill = fill;
             }
@@ -545,7 +545,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
         /// <param name="partForm"></param>
         public static CellStyle DoTablePartStyleType(TablePartStyleType tablePartStyleType, PPTSlide slide, string type, string partForm) {
             //表格单元格文本样式。
-            CellStyle cellStyle = new CellStyle() { type= tablePartStyleType.GetType().Name};
+            CellStyle cellStyle = new CellStyle() { type= tablePartStyleType.LocalName};
             var TableCellTextStyle = tablePartStyleType.GetFirstChild<TableCellTextStyle>();
             if (TableCellTextStyle != null) {
                 FontStyle fontStyle = new FontStyle { };
@@ -730,7 +730,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
                     var TopLeftToBottomRightBorder = TableCellBorders.TopLeftToBottomRightBorder;
                     if (TopLeftToBottomRightBorder != null)
                     {
-                        Border border = DoOutline(TopLeftToBottomRightBorder.Outline, slide, type);
+                           Border border = DoOutline(TopLeftToBottomRightBorder.Outline, slide, type);
                         if (TopLeftToBottomRightBorder.LineReference != null && (border.color.type == null || border.color.type == -1))
                         {
                             border.color.solidFill = DoMatrixReferenceColors(TopLeftToBottomRightBorder.LineReference, slide);
@@ -1404,7 +1404,7 @@ namespace HTEXLib.Helpers.ShapeHelpers
                 var ang = lin.Attribute("ang");
                 var scaledNode = lin.Attribute("scaled");
                 if (ang != null) {
-                    rot=  ShapeHelper.AngleToDegrees(ang.Value) + 90;
+                    rot=  ShapeHelper.AngleToDegrees(ang.Value);
                 }
                 if (scaledNode != null) {
                     scaled = scaledNode.Value;

+ 5 - 6
HTEXLib/Models/HTEX/HtexSlide.cs

@@ -41,18 +41,19 @@ namespace HTEXLib.Models.HTEX
                 int index = 0;
                 foreach (PPTShapeBase baseShape in ContainerShape.Elements)
                 {
-                    var a = DrawShapeHtex(baseShape, index);
-                    if (a != null)
+                    var items = DrawShapeHtex(baseShape, index);
+                    if (items != null)
                     {
-                        htexElements.AddRange(a);
+                        htexElements.AddRange(items);
                     }
-                  
                     index++;
                 }
             }
             return htexElements;
         }
 
+
+        
         public void doAmt(List<IAnimation> animations, string TimingId, List<IAnimation> simpleAnimations)
         {
             if (animations != null) {
@@ -232,8 +233,6 @@ namespace HTEXLib.Models.HTEX
 
         public override string ToString()
         {
-            Console.WriteLine("The id is:" + slide.Id);
-           // Console.WriteLine("The css class is:" + cssClass);
 
             return slide.Id ;
         }

+ 1 - 1
HTEXLib/Models/HTEX/HtexTable.cs

@@ -51,7 +51,7 @@ namespace HTEXLib.Models.HTEX
             List<Tr> trs = new List<Tr>();
             foreach (TableRow row in rows)
             {
-                Tr tr = new Tr { height = row.Height };
+                Tr tr = new Tr { height = row.Height * Globals.px96 * 1.0 / Globals.px914400 };
                 var r = row.Elements<TableCell>();
                 foreach (TableCell cell in r)
                 {

+ 0 - 2
HTEXLib/Models/PPTX/PPTParagraph.cs

@@ -406,11 +406,9 @@ namespace HTEXLib.Models.Inner
             }
             catch (ArgumentOutOfRangeException aoex)
             {
-                Console.WriteLine(aoex.Message);
             }
             catch (ArgumentException aex)
             {
-                Console.WriteLine(aex.Message);
             }
             return imageSize;
         }

+ 0 - 1
HTEXLib/Models/PPTX/PPTRunProperties.cs

@@ -369,7 +369,6 @@ namespace HTEXLib.Models.Inner
                 if (defRun.FontSize != null)
                 {
                     FontSize = defRun.FontSize / Globals.FontPoint;
-                    //Console.WriteLine("The def font size is:" + fontProp.FontSize);
                 }
                 if (defRun.Bold != null)
                 {