OWC pivot table events in a winform

S

schramae

Hi
I am trying to hookup click and double click events to an OWC pivot
table in a c# winform. The backend is Analysis Services. The events
fire but I am not sure how to get the contents of current cell or its
dimension members. I have looked there and wrote the following event
handler. I cannot get seem to get the contents of the current cell.
It dies on the last line and I do not see an exception. Not sure who
is catching it. Wierd com interop stuff.

private void ptLoanGroups_ClickEvent(object sender, EventArgs e)
{
Microsoft.Office.Interop.Owc11.PivotCell cell;
Microsoft.Office.Interop.Owc11.PivotData data;
data = ptGroups.ActiveData;
cell = (Microsoft.Office.Interop.Owc11.PivotCell) data.CurrentCell;

}

The current cell property fails when inspected iwth :
'ptGroups.ActiveData.CurrentCell' threw an exception of type
'System.Runtime.InteropServices.COMException' Microsoft.Office.Interop.Owc11.PivotCell
{System.Runtime.InteropServices.COMException}


Any help or examples are appreciated.

Thx
Eric
 
A

Alvin Bruney [MVP]

eventargs, i'm pretty sure, is not a pivot cell object. It should be of type
event args. That would possibly work on the sender argument. Use the gettype
property to figure out what object it is and then use the appropriate cast.
The exception you are getting would be a conversion type exception if i am
right. I'm not always known to be right by the way.
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top