Type xlsxMargins = Class
	Function Create(sheetobj, file, xml); overload;
	Begin
		sheet_ := sheetobj;
		file_  := file;
		xmlFile_ := xml;
	End;

	Function SetPageMargins(margins);
	Begin
		marshal := margins.Marshal();
		work_node := xmlFile_.FirstChild('worksheet');
		node := work_node.FirstChild('pageMargins');
		work_node.DeleteChild(node);
		prev_node := work_node.FirstChild('phoneticPr');
		work_node.InsertAfterChild(prev_node, marshal);
	End;

	Function GetPageMargins();
	Begin
		node := xmlFile_.FirstChild('worksheet').FirstChild('pageMargins');
		marshal := node.Marshal()[0];
		margins := TOfficeObj('tmargins');
		margins.Bottom := marshal['attributes']['bottom'];
		margins.Footer := marshal['attributes']['footer'];
		margins.Header := marshal['attributes']['header'];
		margins.Left := marshal['attributes']['left'];
		margins.Right := marshal['attributes']['right'];
		margins.Top := marshal['attributes']['top'];
		return margins;
	End

	class Function NewObject(sheetname, file);
	Begin
		o := file.WorkBook().GetSheetObj(sheetname);
		xml := file.WorkBook().GetSheetXmlfile(sheetname);
		if not ifObj(o) then return 0;
		return new xlsxMargins(o, file, xml);
	End;

private
	file_; //TSExcelFile对象
	sheet_;//XmlSheet对象
	xmlFile_; //sheet对应的xml对象
End;
