HtexGraphicFrame.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using DocumentFormat.OpenXml;
  2. using DocumentFormat.OpenXml.Drawing;
  3. using DocumentFormat.OpenXml.Drawing.Diagrams;
  4. using DocumentFormat.OpenXml.Packaging;
  5. using DocumentFormat.OpenXml.Presentation;
  6. using HTEXLib.Helpers.ShapeHelpers;
  7. using HTEXLib.Models.Inner;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. namespace HTEXLib.Models.HTEX
  14. {
  15. public class HtexGraphicFrame : HtexElement
  16. {
  17. public HtexGraphicFrame(string id, double rot, double width, double height,
  18. double top, double left, bool invisible,
  19. bool animatable, int index, Inner.PPTGraphicFrame graphicFrame, PPTSlide slide, string partForm)
  20. // frameId, width, height, top, left, visible, animatable
  21. {
  22. base.slide = slide;
  23. this.rot = rot;
  24. this.graphicFrame = graphicFrame;
  25. base.id = id;
  26. base.top = top;
  27. base.left = left;
  28. base.width = width;
  29. base.height = height;
  30. base.invisible = invisible;
  31. base.animatable = animatable;
  32. base.index = index;
  33. base.type = "GraphicFrame";
  34. base.partForm = partForm;
  35. }
  36. public Inner.PPTGraphicFrame graphicFrame { get; set; }
  37. public override List<Item> DrawElement()
  38. {
  39. List < Item > items= null;
  40. var GraphicDataChildren = graphicFrame.element.Graphic.GraphicData.ChildElements;
  41. foreach (var clild in GraphicDataChildren) {
  42. if (clild is DocumentFormat.OpenXml.Drawing.Table Table) {
  43. HtexTable table = new HtexTable(id,rot,width,height,top,left,invisible,animatable,index,Table,slide,partForm);
  44. items= table.DrawElement();
  45. }
  46. if (clild is DocumentFormat.OpenXml.Drawing.Charts.ChartReference Chart)
  47. {
  48. HtexChart chart = new HtexChart(id, rot, width, height, top, left, invisible, animatable, index, Chart, slide, partForm);
  49. items = chart.DrawElement();
  50. }
  51. if (clild is DocumentFormat.OpenXml.Drawing.Diagrams.RelationshipIds Diagram)
  52. {
  53. HtexDiagram diagram = new HtexDiagram(id, rot, width, height, top, left, invisible, animatable, index, Diagram, slide, partForm);
  54. items = diagram.DrawElement();
  55. }
  56. if (items != null&& items.Count > 0)
  57. {
  58. items[0].uid = graphicFrame.suid;
  59. }
  60. }
  61. return items;
  62. }
  63. }
  64. }