Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
cannot get ListObject using C++
Hi there,
I want to show the autofilter button programmatically from C++ application. However, I cannot get it work yet. Eveen worse, I am not able to get the ListObject. I used the following code. Looks like I got the lists correctly, however, GetCount() always return me zero. and listObj run into an error. I do have some data in the sheet. Any suggestion will be highly appreciated. ListObjects lists; ListObject listObj; lists=objSheet.GetListObjects(); int num=lists.GetCount(); /* for(i=0;i<(int)num;i++) { ListObject listObj=lists.GetItem(COleVariant((short)i)); listObj.SetShowAutoFilter(TRUE); }*/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
cannot get ListObject using C++
I am not familiar with C++, buth with C# syntax I used something like this:
Excel.ListObjects lists; lists = objSheet.ListObjects; Console.WriteLine (lists.Count); Excel.ListObject list; list = lists.get_Item (1); list.ShowAutoFilter = false; Console.WriteLine (list.Name); etc. -- urkec "haiying" wrote: Hi there, I want to show the autofilter button programmatically from C++ application. However, I cannot get it work yet. Eveen worse, I am not able to get the ListObject. I used the following code. Looks like I got the lists correctly, however, GetCount() always return me zero. and listObj run into an error. I do have some data in the sheet. Any suggestion will be highly appreciated. ListObjects lists; ListObject listObj; lists=objSheet.GetListObjects(); int num=lists.GetCount(); /* for(i=0;i<(int)num;i++) { ListObject listObj=lists.GetItem(COleVariant((short)i)); listObj.SetShowAutoFilter(TRUE); }*/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
cannot get ListObject using C++
Hi urkec,
Thanks a lot for your reply. I saw the only difference is console.writeline() Will your code work without this line? If no, I need to find out what is the corresponding C++ function. I am not familiar with C# :<) In my case, lists.count always give me zero somehow and get_item(0) run into a system error. haiying "urkec" wrote: I am not familiar with C++, buth with C# syntax I used something like this: Excel.ListObjects lists; lists = objSheet.ListObjects; Console.WriteLine (lists.Count); Excel.ListObject list; list = lists.get_Item (1); list.ShowAutoFilter = false; Console.WriteLine (list.Name); etc. -- urkec "haiying" wrote: Hi there, I want to show the autofilter button programmatically from C++ application. However, I cannot get it work yet. Eveen worse, I am not able to get the ListObject. I used the following code. Looks like I got the lists correctly, however, GetCount() always return me zero. and listObj run into an error. I do have some data in the sheet. Any suggestion will be highly appreciated. ListObjects lists; ListObject listObj; lists=objSheet.GetListObjects(); int num=lists.GetCount(); /* for(i=0;i<(int)num;i++) { ListObject listObj=lists.GetItem(COleVariant((short)i)); listObj.SetShowAutoFilter(TRUE); }*/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
cannot get ListObject using C++
I think writeline is the same as cout, so the code works without it. I get
the reference to listObjects collection using listObjects property of the Worksheet object. Is objSheet.GetListObjects()function you used same as objSheet.ListObjects property? -- urkec "haiying" wrote: Hi urkec, Thanks a lot for your reply. I saw the only difference is console.writeline() Will your code work without this line? If no, I need to find out what is the corresponding C++ function. I am not familiar with C# :<) In my case, lists.count always give me zero somehow and get_item(0) run into a system error. haiying "urkec" wrote: I am not familiar with C++, buth with C# syntax I used something like this: Excel.ListObjects lists; lists = objSheet.ListObjects; Console.WriteLine (lists.Count); Excel.ListObject list; list = lists.get_Item (1); list.ShowAutoFilter = false; Console.WriteLine (list.Name); etc. -- urkec "haiying" wrote: Hi there, I want to show the autofilter button programmatically from C++ application. However, I cannot get it work yet. Eveen worse, I am not able to get the ListObject. I used the following code. Looks like I got the lists correctly, however, GetCount() always return me zero. and listObj run into an error. I do have some data in the sheet. Any suggestion will be highly appreciated. ListObjects lists; ListObject listObj; lists=objSheet.GetListObjects(); int num=lists.GetCount(); /* for(i=0;i<(int)num;i++) { ListObject listObj=lists.GetItem(COleVariant((short)i)); listObj.SetShowAutoFilter(TRUE); }*/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ListObject - XML question | Excel Programming | |||
ListObject binding | Excel Programming | |||
Events for listobject | Excel Programming | |||
LISTOBJECT question | Excel Programming | |||
listobject ... Excel2003 | Excel Programming |