Type TDocxChart = Class(TSChart)
	///缺省构造函数
	Function Create(docx, chartData); overload;
	Begin
		docx_ := docx;
		class(TSChart).Create(chartData);
		//chartN.xml
		chartId_ := 1 + vselect countof( ['FileName'] ) from docx.Zip().Files() where AnsiStartsText('word/charts/chart', ['FileName']) end;
		targetFileName := 'charts/chart' $ chartId_ $ '.xml';
		chartFile := 'word/' + targetFileName;
		chartFileName_ := chartFile;
		docx.Zip().Add(chartFile, GetDefaultXml());
		xmlObj_ := docx.Zip().Get(chartFile);
		if not chartData_.DisableExcel and istable(chartData.Series) and istable(chartData.Series[0]['Categories']) and istable(chartData.Series[0]['Values']) then Begin
			chartData_.NewExcelFile();
		End;
		Apply(xmlObj_);
		chartData_.AddExcelFile(docx, xmlObj_, chartId_);//添加excel数据文件

		//Relationship
		relsObj := docx.Zip().Get('word/_rels/document.xml.rels');
		[rId_, target] := class(TSXml).FindRelationshipRid(relsObj, '');
		rId_ ++;
		class(TSXml).AddRelationshipRid(relsObj, targetFileName, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart', 'rId' $ rId_);
		//Content_Types
		contentType := docx.Zip().Get('[Content_Types].xml');
		class(TSXml).AddOverrideContentType(contentType, '/' + chartFile, 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
	End;
	
	Function GetInnerXml();
	Begin
		ETU := 360045;//1cm单位
		return format('<w:r>
            <w:drawing>
              <wp:inline>
                <wp:extent cx="%d" cy="%d"/>
                <wp:effectExtent l="0" t="0" r="19050" b="19050"/>
                <wp:docPr id="%d" name="%s"/>
				<wp:cNvGraphicFramePr />
                <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
                    <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
					  <c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId%d"/>
                    </a:graphicData>
                </a:graphic>
            </wp:inline>
          </w:drawing>
		</w:r>', integer(chartData_.Width * ETU), integer(chartData_.Height * ETU), docx_.GetDocPrId(), class(TSXml).CurCodePageToUtf8(chartData_.Name), rId_);
	End;
	
	Function IsWord();override;
	Begin
		return true;
	End;
	
	docx_;
	chartId_;
	rId_;
	xmlObj_;
End;