2

我编写了一个 excel 插件,它创建了一个工作簿并向其中添加了连接对象。但是,只要我添加到工作簿的连接,它就会开始从源下载数据。我们如何避免数据下载,只需添加到工作簿的连接。下面是我的代码的快照: -

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.
4

1 回答 1

1

尝试设置Workbook.UpdateRemoteReferencesFalse.

有关更多详细信息,请访问此 Microsoft 的Excel 开发站点

于 2013-03-13T17:28:11.930 回答