type Cols = 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: Cols);override; public // attributes property property Num read ReadXmlAttrNum write WriteXmlAttrNum; property Space read ReadXmlAttrSpace write WriteXmlAttrSpace; property EqualWidth read ReadXmlAttrEqualWidth write WriteXmlAttrEqualWidth; function ReadXmlAttrNum(); function WriteXmlAttrNum(_value); function ReadXmlAttrSpace(); function WriteXmlAttrSpace(_value); function ReadXmlAttrEqualWidth(); function WriteXmlAttrEqualWidth(_value); // multi property property Cols read ReadCols; function ReadCols(_index); function AddCol(): Col; function AppendCol(): Col; public // Attributes XmlAttrNum: OpenXmlAttribute; XmlAttrSpace: OpenXmlAttribute; XmlAttrEqualWidth: OpenXmlAttribute; // Children end; function Cols.Create();overload; begin {self.}Create(nil, "w", "cols"); end; function Cols.Create(_node: XmlNode);overload; begin class(OpenXmlElement).Create(_node: XmlNode); end; function Cols.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 Cols.Init();override; begin pre := {self.}Prefix ? {self.}Prefix + ":" : ""; attributes_ := array(); attributes_pf_ := array( pre + "num": makeweakref(thisFunction(WriteXmlAttrNum)), pre + "space": makeweakref(thisFunction(WriteXmlAttrSpace)), pre + "equalWidth": makeweakref(thisFunction(WriteXmlAttrEqualWidth)), ); sorted_child_ := array( pre + "col": array(0, makeweakref(thisFunction(AppendCol))), ); container_ := new TSOfficeContainer(sorted_child_); end; function Cols.Copy(_obj: Cols);override; begin tslassigning_backup := tslassigning; tslassigning := 1; class(OpenXmlElement).Copy(_obj); if not ifnil(_obj.Num) then {self.}Num := _obj.Num; if not ifnil(_obj.Space) then {self.}Space := _obj.Space; if not ifnil(_obj.EqualWidth) then {self.}EqualWidth := _obj.EqualWidth; tslassigning := tslassigning_backup; end; function Cols.ReadXmlAttrNum(); begin return {self.}XmlAttrNum.Value; end; function Cols.WriteXmlAttrNum(_value); begin if ifnil({self.}XmlAttrNum) then begin {self.}XmlAttrNum := new OpenXmlAttribute({self.}Prefix, "num", nil); attributes_[length(attributes_)] := {self.}XmlAttrNum; end {self.}XmlAttrNum.Value := _value; end; function Cols.ReadXmlAttrSpace(); begin return {self.}XmlAttrSpace.Value; end; function Cols.WriteXmlAttrSpace(_value); begin if ifnil({self.}XmlAttrSpace) then begin {self.}XmlAttrSpace := new OpenXmlAttribute({self.}Prefix, "space", nil); attributes_[length(attributes_)] := {self.}XmlAttrSpace; end {self.}XmlAttrSpace.Value := _value; end; function Cols.ReadXmlAttrEqualWidth(); begin return {self.}XmlAttrEqualWidth.Value; end; function Cols.WriteXmlAttrEqualWidth(_value); begin if ifnil({self.}XmlAttrEqualWidth) then begin {self.}XmlAttrEqualWidth := new OpenXmlAttribute({self.}Prefix, "equalWidth", nil); attributes_[length(attributes_)] := {self.}XmlAttrEqualWidth; end {self.}XmlAttrEqualWidth.Value := _value; end; function Cols.ReadCols(_index); begin ind := ifnil(_index) ? -2 : _index; pre := {self.}Prefix ? {self.}Prefix + ":" : ""; return container_.Get(pre + "col", ind); end; function Cols.AddCol(): Col; begin obj := new Col(self, {self.}Prefix, "col"); container_.Insert(obj); return obj; end; function Cols.AppendCol(): Col; begin obj := new Col(self, {self.}Prefix, "col"); container_.Append(obj); return obj; end;