fpspreadsheet: First empty xlsx chart written which is not rejected by Excel.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9187 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
e3cba0674d
commit
ec71c9e1af
@ -6570,6 +6570,7 @@ procedure TsSpreadOOXMLWriter.WriteDrawings(AWorksheet: TsBasicWorksheet);
|
||||
roffs1, coffs1, roffs2, coffs2: Double;
|
||||
x, y, w, h: Double;
|
||||
sheet: TsWorksheet;
|
||||
guid: TGUID;
|
||||
begin
|
||||
r1 := AChart.Row;
|
||||
c1 := AChart.Col;
|
||||
@ -6590,16 +6591,20 @@ procedure TsSpreadOOXMLWriter.WriteDrawings(AWorksheet: TsBasicWorksheet);
|
||||
AnchorAsXML(4, 'xdr:to', c2, r2, coffs2, roffs2) + LE
|
||||
);
|
||||
|
||||
CreateGUID(guid);
|
||||
AppendToStream(AStream, Format(
|
||||
' <xdr:graphicFrame macro="">' + LE +
|
||||
' <xdr:nvGraphicFramePr>' + LE +
|
||||
' <xdr:cNvPr id="%d" name="Diagram %d">' + LE + // line 1
|
||||
//{
|
||||
' <a:extLst>' + LE +
|
||||
' <a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">' + LE +
|
||||
' <a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" ' +
|
||||
'id="{00000000-0008-0000-0000-000002000000}"/>' + LE +
|
||||
'id="' + GUIDToString(guid) + '"/>' + LE +
|
||||
// 'id="{00000000-0008-0000-0000-000002000000}"/>' + LE +
|
||||
' </a:ext>' + LE +
|
||||
' </a:extLst>' + LE +
|
||||
//}
|
||||
' </xdr:cNvPr>' + LE +
|
||||
' <xdr:cNvGraphicFramePr />' + LE +
|
||||
' </xdr:nvGraphicFramePr>' + LE +
|
||||
@ -7454,7 +7459,7 @@ begin
|
||||
'<Default Extension="rels" ContentType="%s" />' + LineEnding, [MIME_RELS]));
|
||||
AppendToStream(FSContentTypes, Format(
|
||||
'<Default Extension="xml" ContentType="%s" />' + LineEnding, [MIME_XML]));
|
||||
AppendToStream(FSContentTypes, Format(
|
||||
AppendToStream(FSContentTypes, Format(
|
||||
'<Default Extension="vml" ContentType="%s" />' + LineEnding, [MIME_VMLDRAWING]));
|
||||
|
||||
if book.GetEmbeddedObjCount > 0 then
|
||||
@ -7479,17 +7484,13 @@ begin
|
||||
AppendToStream(FSContentTypes,
|
||||
'<Override PartName="/xl/workbook.xml" ContentType="' + MIME_SHEET + '" />' + LineEnding);
|
||||
|
||||
{$ifdef FPS_CHARTS}
|
||||
TsSpreadOOXMLChartWriter(FChartWriter).WriteChartContentTypes(FSContentTypes);
|
||||
{$endif}
|
||||
|
||||
for i:=1 to book.GetWorksheetCount do
|
||||
begin
|
||||
AppendToStream(FSContentTypes, Format(
|
||||
'<Override PartName="/xl/worksheets/sheet%d.xml" ContentType="%s" />' + LineEnding,
|
||||
[i, MIME_WORKSHEET]));
|
||||
sheet := book.GetWorksheetByIndex(i-1);
|
||||
if sheet.GetImageCount > 0 then
|
||||
if (sheet.GetImageCount > 0) {$ifdef FPS_CHARTS} or (sheet.GetChartCount > 0){$endif} then
|
||||
AppendToStream(FSContentTypes, Format(
|
||||
'<Override PartName="/xl/drawings/drawing%d.xml" ContentType="%s"/>' + LineEnding,
|
||||
[i, MIME_DRAWING]));
|
||||
@ -7505,6 +7506,10 @@ begin
|
||||
AppendToStream(FSContentTypes,
|
||||
'<Override PartName="/xl/sharedStrings.xml" ContentType="' + MIME_STRINGS + '" />' + LineEnding);
|
||||
|
||||
{$ifdef FPS_CHARTS}
|
||||
TsSpreadOOXMLChartWriter(FChartWriter).WriteChartContentTypes(FSContentTypes);
|
||||
{$endif}
|
||||
|
||||
AppendToStream(FSContentTypes,
|
||||
'<Override PartName="/docProps/core.xml" ContentType="' + MIME_CORE + '" />');
|
||||
|
||||
|
@ -3084,6 +3084,44 @@ var
|
||||
chart: TsChart;
|
||||
xAxID, yAxID: Integer;
|
||||
begin
|
||||
AppendToStream(AStream,
|
||||
'<?xml version="1.0" encoding="utf-8" standalone="yes"?>' + LE +
|
||||
'<c:chartSpace xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">' + LE +
|
||||
' <c:chart>' + LE +
|
||||
' <c:plotArea>' + LE +
|
||||
' <c:scatterChart>' + LE +
|
||||
' <c:scatterStyle val="lineMarker"/>' + LE +
|
||||
' <c:ser>' + LE +
|
||||
' <c:idx val="0"/>' + LE +
|
||||
' <c:order val="0"/>' + LE +
|
||||
' </c:ser>' + LE +
|
||||
' <c:axId val="62239872"/>' + LE +
|
||||
' <c:axId val="62229888"/>' + LE +
|
||||
' </c:scatterChart>' + LE +
|
||||
' <c:valAx>' + LE +
|
||||
' <c:axId val="62239872"/>' + LE +
|
||||
' <c:axPos val="b" />' + LE +
|
||||
' <c:scaling>' + LE +
|
||||
' <c:orientation val="minMax"/>' + LE +
|
||||
' </c:scaling>' + LE +
|
||||
' <c:crossAx val="62229888" />' + LE +
|
||||
' </c:valAx>' + LE +
|
||||
' <c:valAx>' + LE +
|
||||
' <c:axId val="62229888"/>' + LE +
|
||||
' <c:axPos val="l" />' + LE +
|
||||
' <c:scaling>' + LE +
|
||||
' <c:orientation val="minMax"/>' + LE +
|
||||
' </c:scaling>' + LE +
|
||||
' <c:crossAx val="62239872" />' + LE +
|
||||
' </c:valAx>' + LE +
|
||||
' </c:plotArea>' + LE +
|
||||
' </c:chart>' + LE +
|
||||
'</c:chartSpace>' + LE
|
||||
);
|
||||
(*
|
||||
|
||||
|
||||
|
||||
chart := TsWorkbook(Writer.Workbook).GetChartByIndex(AChartIndex);
|
||||
AppendToStream(AStream,
|
||||
XML_HEADER + LE);
|
||||
@ -3114,6 +3152,7 @@ begin
|
||||
AppendToStream(AStream,
|
||||
'</c:chartSpace>' + LE
|
||||
);
|
||||
*)
|
||||
end;
|
||||
|
||||
function TsSpreadOOXMLChartWriter.GetChartFillAndLineXML(AIndent: Integer;
|
||||
@ -3194,6 +3233,16 @@ begin
|
||||
ind + '<c:plotArea>' + LE +
|
||||
ind + ' <c:layout/>' + LE +
|
||||
|
||||
ind + ' <c:scatterChart>' +LE +
|
||||
ind + ' <c:scatterStyle val="lineMarker"/>' + LE +
|
||||
ind + ' <c:ser>' + LE +
|
||||
ind + ' <c:idx val="0"/>' + LE +
|
||||
ind + ' <c:order val="0"/>' + LE +
|
||||
ind + ' </c:ser>' + LE +
|
||||
ind + ' <c:axId val="62239872"/>' + LE +
|
||||
ind + ' <c:axId val="62229888"/>' + LE +
|
||||
ind + ' </c:scatterChart>' + LE +
|
||||
{
|
||||
ind + ' <c:barChart>' + LE +
|
||||
ind + ' <c:barDir val="col"/>' + LE +
|
||||
ind + ' <c:grouping val="clustered"/>' + LE +
|
||||
@ -3211,11 +3260,11 @@ begin
|
||||
ind + ' <c:axId val="402915176"/>' + LE +
|
||||
ind + ' <c:axId val="402915536"/>' + LE +
|
||||
ind + ' </c:barChart>' + LE +
|
||||
|
||||
}
|
||||
ind + ' <c:catAx>' + LE +
|
||||
ind + ' <c:axId val="402915176"/>' + LE +
|
||||
ind + ' <c:axId val="62239872"/>' + LE +
|
||||
ind + ' <c:scaling>' + LE +
|
||||
ind + ' <c:orientation val="minMax"/>' + LE +
|
||||
ind + ' <c:orientation val="minMax"/>' + LE +
|
||||
ind + ' </c:scaling>' + LE +
|
||||
ind + ' <c:delete val="0"/>' + LE +
|
||||
ind + ' <c:axPos val="b"/>' + LE +
|
||||
@ -3256,7 +3305,7 @@ begin
|
||||
ind + ' <a:endParaRPr lang="de-DE"/>' + LE +
|
||||
ind + ' </a:p>' + LE +
|
||||
ind + ' </c:txPr>' + LE +
|
||||
ind + ' <c:crossAx val="402915536"/>' + LE +
|
||||
ind + ' <c:crossAx val="62229888"/>' + LE +
|
||||
ind + ' <c:crosses val="autoZero"/>' + LE +
|
||||
ind + ' <c:auto val="1"/>' + LE +
|
||||
ind + ' <c:lblAlgn val="ctr"/>' + LE +
|
||||
@ -3265,7 +3314,7 @@ begin
|
||||
ind + ' </c:catAx>' + LE +
|
||||
|
||||
ind + ' <c:valAx>' + LE +
|
||||
ind + ' <c:axId val="402915536"/>' + LE +
|
||||
ind + ' <c:axId val="62229888"/>' + LE +
|
||||
ind + ' <c:scaling>' + LE +
|
||||
ind + ' <c:orientation val="minMax"/>' + LE +
|
||||
ind + ' </c:scaling>' + LE +
|
||||
@ -3316,7 +3365,7 @@ begin
|
||||
ind + ' <a:endParaRPr lang="de-DE"/>' + LE +
|
||||
ind + ' </a:p>' + LE +
|
||||
ind + ' </c:txPr>' + LE +
|
||||
ind + ' <c:crossAx val="402915176"/>' + LE +
|
||||
ind + ' <c:crossAx val="62239872"/>' + LE +
|
||||
ind + ' <c:crosses val="autoZero"/>' + LE +
|
||||
ind + ' <c:crossBetween val="between"/>' + LE +
|
||||
ind + ' </c:valAx>' + LE +
|
||||
@ -3327,6 +3376,7 @@ begin
|
||||
ind + ' </a:ln>' + LE +
|
||||
ind + ' <a:effectLst/>' + LE +
|
||||
ind + ' </c:spPr>' + LE +
|
||||
|
||||
ind + '</c:plotArea>' + LE
|
||||
);
|
||||
end;
|
||||
@ -3337,9 +3387,9 @@ var
|
||||
begin
|
||||
for i := 0 to TsWorkbook(Writer.Workbook).GetChartCount - 1 do
|
||||
begin
|
||||
WriteChartRelsXML(FSChartRels[i], i);
|
||||
WriteChartStylesXML(FSChartStyles[i], i);
|
||||
WriteChartColorsXML(FSChartColors[i], i);
|
||||
// WriteChartRelsXML(FSChartRels[i], i);
|
||||
// WriteChartStylesXML(FSChartStyles[i], i);
|
||||
// WriteChartColorsXML(FSChartColors[i], i);
|
||||
WriteChartXML(FSCharts[i], i);
|
||||
end;
|
||||
end;
|
||||
@ -3355,7 +3405,7 @@ begin
|
||||
ind + '<c:title>' + LE +
|
||||
ind + ' <c:overlay val="0"/>' + LE
|
||||
);
|
||||
|
||||
{
|
||||
AppendToStream(AStream,
|
||||
GetChartFillAndLineXML(AIndent + 2, ATitle.Background, ATitle.Border)
|
||||
);
|
||||
@ -3384,10 +3434,11 @@ begin
|
||||
ind + ' </a:p>' + LE +
|
||||
ind + ' </c:txPr>' + LE
|
||||
);
|
||||
|
||||
}
|
||||
AppendToStream(AStream,
|
||||
ind + '</c:title>' + LE
|
||||
);
|
||||
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
Loading…
Reference in New Issue
Block a user