type FldSimple = 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: FldSimple);override; public // attributes property property Instr read ReadXmlAttrInstr write WriteXmlAttrInstr; function ReadXmlAttrInstr(); function WriteXmlAttrInstr(_value); // multi property property Rs read ReadRs; function ReadRs(_index); function AddR(): R; function AppendR(): R; public // Attributes XmlAttrInstr: OpenXmlAttribute; // Children end; function FldSimple.Create();overload; begin {self.}Create(nil, "w", "fldSimple"); end; function FldSimple.Create(_node: XmlNode);overload; begin class(OpenXmlElement).Create(_node: XmlNode); end; function FldSimple.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 FldSimple.Init();override; begin pre := {self.}Prefix ? {self.}Prefix + ":" : ""; attributes_ := array(); attributes_pf_ := array( pre + "instr": makeweakref(thisFunction(WriteXmlAttrInstr)), ); sorted_child_ := array( pre + "r": array(0, makeweakref(thisFunction(AppendR))), ); container_ := new TSOfficeContainer(sorted_child_); end; function FldSimple.Copy(_obj: FldSimple);override; begin tslassigning_backup := tslassigning; tslassigning := 1; class(OpenXmlElement).Copy(_obj); if not ifnil(_obj.Instr) then {self.}Instr := _obj.Instr; tslassigning := tslassigning_backup; end; function FldSimple.ReadXmlAttrInstr(); begin return {self.}XmlAttrInstr.Value; end; function FldSimple.WriteXmlAttrInstr(_value); begin if ifnil({self.}XmlAttrInstr) then begin {self.}XmlAttrInstr := new OpenXmlAttribute({self.}Prefix, "instr", nil); attributes_[length(attributes_)] := {self.}XmlAttrInstr; end {self.}XmlAttrInstr.Value := _value; end; function FldSimple.ReadRs(_index); begin ind := ifnil(_index) ? -2 : _index; pre := {self.}Prefix ? {self.}Prefix + ":" : ""; return container_.Get(pre + "r", ind); end; function FldSimple.AddR(): R; begin obj := new R(self, {self.}Prefix, "r"); container_.Insert(obj); return obj; end; function FldSimple.AppendR(): R; begin obj := new R(self, {self.}Prefix, "r"); container_.Append(obj); return obj; end;