type PgMar = 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: PgMar);override; public // attributes property property Top read ReadXmlAttrTop write WriteXmlAttrTop; property Right read ReadXmlAttrRight write WriteXmlAttrRight; property Bottom read ReadXmlAttrBottom write WriteXmlAttrBottom; property Left read ReadXmlAttrLeft write WriteXmlAttrLeft; property Header read ReadXmlAttrHeader write WriteXmlAttrHeader; property Footer read ReadXmlAttrFooter write WriteXmlAttrFooter; property Gutter read ReadXmlAttrGutter write WriteXmlAttrGutter; function ReadXmlAttrTop(); function WriteXmlAttrTop(_value); function ReadXmlAttrRight(); function WriteXmlAttrRight(_value); function ReadXmlAttrBottom(); function WriteXmlAttrBottom(_value); function ReadXmlAttrLeft(); function WriteXmlAttrLeft(_value); function ReadXmlAttrHeader(); function WriteXmlAttrHeader(_value); function ReadXmlAttrFooter(); function WriteXmlAttrFooter(_value); function ReadXmlAttrGutter(); function WriteXmlAttrGutter(_value); public // Attributes XmlAttrTop: OpenXmlAttribute; XmlAttrRight: OpenXmlAttribute; XmlAttrBottom: OpenXmlAttribute; XmlAttrLeft: OpenXmlAttribute; XmlAttrHeader: OpenXmlAttribute; XmlAttrFooter: OpenXmlAttribute; XmlAttrGutter: OpenXmlAttribute; end; function PgMar.Create();overload; begin {self.}Create(nil, "w", "pgMar"); end; function PgMar.Create(_node: XmlNode);overload; begin class(OpenXmlElement).Create(_node: XmlNode); end; function PgMar.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 PgMar.Init();override; begin pre := {self.}Prefix ? {self.}Prefix + ":" : ""; attributes_ := array(); attributes_pf_ := array( pre + "top": makeweakref(thisFunction(WriteXmlAttrTop)), pre + "right": makeweakref(thisFunction(WriteXmlAttrRight)), pre + "bottom": makeweakref(thisFunction(WriteXmlAttrBottom)), pre + "left": makeweakref(thisFunction(WriteXmlAttrLeft)), pre + "header": makeweakref(thisFunction(WriteXmlAttrHeader)), pre + "footer": makeweakref(thisFunction(WriteXmlAttrFooter)), pre + "gutter": makeweakref(thisFunction(WriteXmlAttrGutter)), ); sorted_child_ := array( ); container_ := new TSOfficeContainer(sorted_child_); end; function PgMar.Copy(_obj: PgMar);override; begin tslassigning_backup := tslassigning; tslassigning := 1; class(OpenXmlElement).Copy(_obj); if not ifnil(_obj.Top) then {self.}Top := _obj.Top; if not ifnil(_obj.Right) then {self.}Right := _obj.Right; if not ifnil(_obj.Bottom) then {self.}Bottom := _obj.Bottom; if not ifnil(_obj.Left) then {self.}Left := _obj.Left; if not ifnil(_obj.Header) then {self.}Header := _obj.Header; if not ifnil(_obj.Footer) then {self.}Footer := _obj.Footer; if not ifnil(_obj.Gutter) then {self.}Gutter := _obj.Gutter; tslassigning := tslassigning_backup; end; function PgMar.ReadXmlAttrTop(); begin return {self.}XmlAttrTop.Value; end; function PgMar.WriteXmlAttrTop(_value); begin if ifnil({self.}XmlAttrTop) then begin {self.}XmlAttrTop := new OpenXmlAttribute({self.}Prefix, "top", nil); attributes_[length(attributes_)] := {self.}XmlAttrTop; end {self.}XmlAttrTop.Value := _value; end; function PgMar.ReadXmlAttrRight(); begin return {self.}XmlAttrRight.Value; end; function PgMar.WriteXmlAttrRight(_value); begin if ifnil({self.}XmlAttrRight) then begin {self.}XmlAttrRight := new OpenXmlAttribute({self.}Prefix, "right", nil); attributes_[length(attributes_)] := {self.}XmlAttrRight; end {self.}XmlAttrRight.Value := _value; end; function PgMar.ReadXmlAttrBottom(); begin return {self.}XmlAttrBottom.Value; end; function PgMar.WriteXmlAttrBottom(_value); begin if ifnil({self.}XmlAttrBottom) then begin {self.}XmlAttrBottom := new OpenXmlAttribute({self.}Prefix, "bottom", nil); attributes_[length(attributes_)] := {self.}XmlAttrBottom; end {self.}XmlAttrBottom.Value := _value; end; function PgMar.ReadXmlAttrLeft(); begin return {self.}XmlAttrLeft.Value; end; function PgMar.WriteXmlAttrLeft(_value); begin if ifnil({self.}XmlAttrLeft) then begin {self.}XmlAttrLeft := new OpenXmlAttribute({self.}Prefix, "left", nil); attributes_[length(attributes_)] := {self.}XmlAttrLeft; end {self.}XmlAttrLeft.Value := _value; end; function PgMar.ReadXmlAttrHeader(); begin return {self.}XmlAttrHeader.Value; end; function PgMar.WriteXmlAttrHeader(_value); begin if ifnil({self.}XmlAttrHeader) then begin {self.}XmlAttrHeader := new OpenXmlAttribute({self.}Prefix, "header", nil); attributes_[length(attributes_)] := {self.}XmlAttrHeader; end {self.}XmlAttrHeader.Value := _value; end; function PgMar.ReadXmlAttrFooter(); begin return {self.}XmlAttrFooter.Value; end; function PgMar.WriteXmlAttrFooter(_value); begin if ifnil({self.}XmlAttrFooter) then begin {self.}XmlAttrFooter := new OpenXmlAttribute({self.}Prefix, "footer", nil); attributes_[length(attributes_)] := {self.}XmlAttrFooter; end {self.}XmlAttrFooter.Value := _value; end; function PgMar.ReadXmlAttrGutter(); begin return {self.}XmlAttrGutter.Value; end; function PgMar.WriteXmlAttrGutter(_value); begin if ifnil({self.}XmlAttrGutter) then begin {self.}XmlAttrGutter := new OpenXmlAttribute({self.}Prefix, "gutter", nil); attributes_[length(attributes_)] := {self.}XmlAttrGutter; end {self.}XmlAttrGutter.Value := _value; end;