Cloud Computing Insider Awards 2022: Vote for ONLYOFFICE
Vote for ONLYOFFICE

Copying a chart from one doc to another

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();

Any thoughts on this? (sorry, but it is a little urgent :-))

Hello @Mitch
We are checking the situation. I will update this post when we get any news.

Thank you so much!!! I’ve got a big demo on Wednesday and I really want to showcase you guys!

Any luck in this? Demo slipped to tomorrow!

I’m really sorry, but we are still checking this situation. I will update this post when we get any news.

Hello @Mitch
Sorry for the late reply.
Unfortunately, we can’t provide you with ready-to-go solution on this request. We are working to improve DocBuilder methods at the moment and probably one day we will go back to this request. But I can’t help you at the moment.
Sorry for inconvenience.