type GraphicData = class(OpenXmlElement) public function Create();overload; function Create(_node: XmlNode);overload; function Create(_parent: tslobj; _prefix: string; _local_name: string);overload; function Init();override; function InitAttributes();override; function InitChildren();override; function InitNode(_node: XmlNode);override; function Copy(_obj: GraphicData);override; property Uri read ReadXmlAttrUri write WriteXmlAttrUri; function ReadXmlAttrUri(); function WriteXmlAttrUri(_value); public // Attributes XmlAttrUri: OpenXmlAttribute; // Children Pic: Pic; Chart: Chart; end; function GraphicData.Create();overload; begin self.Create(nil, "a", "graphicData"); end; function GraphicData.Create(_node: XmlNode);overload; begin class(OpenXmlElement).Create(_node: XmlNode); end; function GraphicData.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function GraphicData.Init();override; begin self.XmlAttrUri := new OpenXmlAttribute(nil, "uri", "http://schemas.openxmlformats.org/drawingml/2006/picture"); self.Pic := new Pic(self, "pic", "pic"); self.Chart := new Chart(self, "c", "chart"); end; function GraphicData.InitAttributes();override; begin attributes_ := array( self.XmlAttrUri, ); end; function GraphicData.InitChildren();override; begin child_elements_ := array( 0: self.Pic, 1: self.Chart, ); sorted_child_ := array( "": -1, self.Pic.ElementName: 0, self.Chart.ElementName: 1, ); end; function GraphicData.InitNode(_node: XmlNode);override; begin if ifObj(self.XmlNode) then for k,v in child_elements_ do v.InitNode(nil); self.XmlNode := ifObj(_node) ? _node : nil; node := ifObj(_node) ? _node.FirstChild() : nil; flag := false; if ifnil(child_elements_[0]) and length(child_elements_) > 0 then begin flag := true; arr := child_elements_; child_elements_ := array(); end pre := ifString(self.Prefix) ? self.Prefix + ":" : ""; while ifObj(node) do begin node_name := node.GetName(); pos := sorted_child_[node_name]; if ifnil(pos) or pos = -1 then begin obj := nil; case node_name of end; if ifObj(obj) then obj.InitNode(node); end else if flag then begin obj := arr[pos]; obj.InitNode(node); child_elements_[length(child_elements_)] := obj; end else begin child_elements_[pos].InitNode(node); end node := node.NextElement(); end end; function GraphicData.Copy(_obj: GraphicData);override; begin if not ifnil(_obj.XmlAttrUri.Value) then self.XmlAttrUri.Value := _obj.XmlAttrUri.Value; self.Pic.Copy(_obj.Pic); self.Chart.Copy(_obj.Chart); end; function GraphicData.ReadXmlAttrUri(); begin return self.XmlAttrUri.Value; end; function GraphicData.WriteXmlAttrUri(_value); begin self.XmlAttrUri.Value := _value; end;