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);
> > > }*/
> > >
> > >
> > >
|