Microsoft Office Interop Excel [英] Microsoft Office Interop Excel

查看:122
本文介绍了Microsoft Office Interop Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2008在asp.net/C#/.net 3.5中开发Microsoft.Office.Interopt.Excel应用程序.

我正在尝试刷新数据透视表,但
以下语句不会编译.

I''m developing a Microsoft.Office.Interopt.Excel app in asp.net/C#/.net 3.5, using VS 2008.

I''m trying to refresh a pivot table but the
The following statement won''t compile .

wkSheet.PivotTables("PivotTable1").PivotCache.Refresh;



我不断收到以下2个错误.有人可以帮忙吗?



I keep getting the following 2 erros. Can someone please help!

1.   Only assignment, call, increment, decrement, and new object expressions can be used as a statement	

2.   'object' does not contain a definition for 'PivotCache' and no extension method 'PivotCache' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

推荐答案

这两个消息都相当清晰,请尝试以下操作:
Both of those messages ar fairly clear, try something like:
PivotTable pvtTable = (PivotTable)wkSheet.PivotTables("PivotTable1");
pvtTable.RefreshTable();


这篇关于Microsoft Office Interop Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆