type Comment = 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 Copy(_obj: Comment);override; public // attributes property property Author read ReadXmlAttrAuthor write WriteXmlAttrAuthor; property Date read ReadXmlAttrDate write WriteXmlAttrDate; property Id read ReadXmlAttrId write WriteXmlAttrId; function ReadXmlAttrAuthor(); function WriteXmlAttrAuthor(_value); function ReadXmlAttrDate(); function WriteXmlAttrDate(_value); function ReadXmlAttrId(); function WriteXmlAttrId(_value); // multi property property Ps read ReadPs; function ReadPs(_index); function AddP(): P; function AppendP(): P; public // Attributes XmlAttrAuthor: OpenXmlAttribute; XmlAttrDate: OpenXmlAttribute; XmlAttrId: OpenXmlAttribute; // Children end; function Comment.Create();overload; begin {self.}Create(nil, "w", "comment"); end; function Comment.Create(_node: XmlNode);overload; begin class(OpenXmlElement).Create(_node: XmlNode); end; function Comment.Create(_parent: tslobj; _prefix: string; _local_name: string);overload; begin setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200); class(OpenXmlElement).Create(_parent, _prefix, _local_name); end; function Comment.Init();override; begin pre := {self.}Prefix ? {self.}Prefix + ":" : ""; attributes_ := array(); attributes_pf_ := array( pre + "author": makeweakref(thisFunction(WriteXmlAttrAuthor)), pre + "date": makeweakref(thisFunction(WriteXmlAttrDate)), pre + "id": makeweakref(thisFunction(WriteXmlAttrId)), ); sorted_child_ := array( pre + "p": array(0, makeweakref(thisFunction(AppendP))), ); container_ := new TSOfficeContainer(sorted_child_); end; function Comment.Copy(_obj: Comment);override; begin tslassigning_backup := tslassigning; tslassigning := 1; class(OpenXmlElement).Copy(_obj); if not ifnil(_obj.Author) then {self.}Author := _obj.Author; if not ifnil(_obj.Date) then {self.}Date := _obj.Date; if not ifnil(_obj.Id) then {self.}Id := _obj.Id; tslassigning := tslassigning_backup; end; function Comment.ReadXmlAttrAuthor(); begin return {self.}XmlAttrAuthor.Value; end; function Comment.WriteXmlAttrAuthor(_value); begin if ifnil({self.}XmlAttrAuthor) then begin {self.}XmlAttrAuthor := new OpenXmlAttribute({self.}Prefix, "author", nil); attributes_[length(attributes_)] := {self.}XmlAttrAuthor; end {self.}XmlAttrAuthor.Value := _value; end; function Comment.ReadXmlAttrDate(); begin return {self.}XmlAttrDate.Value; end; function Comment.WriteXmlAttrDate(_value); begin if ifnil({self.}XmlAttrDate) then begin {self.}XmlAttrDate := new OpenXmlAttribute({self.}Prefix, "date", nil); attributes_[length(attributes_)] := {self.}XmlAttrDate; end {self.}XmlAttrDate.Value := _value; end; function Comment.ReadXmlAttrId(); begin return {self.}XmlAttrId.Value; end; function Comment.WriteXmlAttrId(_value); begin if ifnil({self.}XmlAttrId) then begin {self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil); attributes_[length(attributes_)] := {self.}XmlAttrId; end {self.}XmlAttrId.Value := _value; end; function Comment.ReadPs(_index); begin ind := ifnil(_index) ? -2 : _index; pre := {self.}Prefix ? {self.}Prefix + ":" : ""; return container_.Get(pre + "p", ind); end; function Comment.AddP(): P; begin obj := new P(self, {self.}Prefix, "p"); container_.Insert(obj); return obj; end; function Comment.AppendP(): P; begin obj := new P(self, {self.}Prefix, "p"); container_.Append(obj); return obj; end;