I want to open a doc, grab a chart from it, and copy it to another document.
I’m encouraged by your GlobalVariable example, and I did the following below. Would you expect it to work? I got a blank document.
builder.CreateFile(“docx”);
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oDrawing = Api.CreateChart(“bar3D”, [
[200, 240, 280],
[250, 260, 280]
], [“Projected Revenue”, “Estimated Costs”], [2014, 2015, 2016], 4051300, 2347595, 24);
oDrawing.SetVerAxisTitle(“USD In Hundred Thousands”, 10);
oDrawing.SetHorAxisTitle(“Year”, 11);
oDrawing.SetLegendPos(“bottom”);
oDrawing.SetShowDataLabels(false, false, true, false);
oDrawing.SetTitle(“Financial Overview”, 13);
oParagraph.AddDrawing(oDrawing);
GlobalVariable[“myChart”] = oDrawing;
builder.SaveFile(“docx”, “ApiChart.docx”);
builder.CloseFile();
builder.CreateFile(“docx”);
oDocument = Api.GetDocument();
oParagraph = oDocument.GetElement(0);
oDrawing = GlobalVariable[“myChart”];
oParagraph.AddDrawing(oDrawing);
builder.SaveFile(“docx”, “ApiChart COMBO Dave.docx”);
builder.CloseFile();