Reputation: 483
I have written an excel plugin which creates a workbook and add connection object to it. But, as soon as I add connection to workbook it starts downloading data from source. How can we avoid data downloading and just add connection to workbook. Below is snapshot of my code:-
Application app = new Microsoft.Office.Interop.Excel.Application();
app.Visible = false;
WorkBook workbook = app.Workbooks.Add(1);
string connectionString = "DATAFEED;Data Source=" + odataURL + ";Namespaces to Include=*;Max Received Message Size=4398046511104;Integrated Security=Basic;User ID=" + tokens[0] + ";Password=" + tokens[1] + ";Persist Security Info=false;Base Url=" + odataURL;
workbook.Connections.Add2("Feeds", "MyFeeds", connectionString,"ExecutedReport", Type.Missing, true, Type.Missing); // this step downloads data from source. How to avoid it.
Upvotes: 2
Views: 888
Reputation: 2436
Try setting Workbook.UpdateRemoteReferences
to False
.
More details are on this Microsoft's Excel Development site.
Upvotes: 1