HtexGraphicFrame.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. var GraphicDataChildren = graphicFrame.element.Graphic.GraphicData.ChildElements;
  40. foreach (var clild in GraphicDataChildren) {
  41. if (clild is DocumentFormat.OpenXml.Drawing.Table Table) {
  42. HtexTable table = new HtexTable(id,rot,width,height,top,left,invisible,animatable,index,Table,slide,partForm);
  43. return table.DrawElement();
  44. }
  45. if (clild is DocumentFormat.OpenXml.Drawing.Charts.ChartReference Chart)
  46. {
  47. HtexChart chart = new HtexChart(id, rot, width, height, top, left, invisible, animatable, index, Chart, slide, partForm);
  48. return chart.DrawElement();
  49. }
  50. if (clild is DocumentFormat.OpenXml.Drawing.Diagrams.RelationshipIds Diagram)
  51. {
  52. HtexDiagram diagram = new HtexDiagram(id, rot, width, height, top, left, invisible, animatable, index, Diagram, slide, partForm);
  53. return diagram.DrawElement();
  54. }
  55. }
  56. return null;
  57. }
  58. }
  59. }