Kandola

Would like to bind list object in Excel 2007 Add-in.
Data comes from a webservice.
Data format is collection of objects (public properties).

I cannot seem to find any samples. All I seem to find is code to bind to tables like below (no good).

Excel.Worksheet ws = (Excel.Worksheet)Application.ActiveSheet;

Excel.ListObject lo = ws.ListObjects.Add(Microsoft.Office.Interop.Excel.XlListObjectSourceType.xlSrcExternal,
source,
true,
Microsoft.Office.Interop.Excel.XlYesNoGuess.xlGuess,
this.Application.ActiveCell);

lo.ListRows.Add(0);

lo.QueryTable.CommandType = Microsoft.Office.Interop.Excel.XlCmdType.xlCmdTable;
lo.QueryTable.CommandText = "Northwinds...";
lo.QueryTable.Refresh(missing);



Re: Visual Studio Tools for Office Binding to collection of objects in Excel 2007 Add-in


Re: Visual Studio Tools for Office Binding to collection of objects in Excel 2007 Add-in

Mohit Gupta - MSFT

Hi.

The VSTO listobject databinding capability is only available for document level customizations. In your scenario, you are using an add-in and therefore you must use the Excel OM and features in it to do this binding.

HTH

Mohit.






Re: Visual Studio Tools for Office Binding to collection of objects in Excel 2007 Add-in

Kandola

Thanks for the feedback.

Two questions:

1. Where is the documentation for the Excel OM (from a .NET perspective)
2. When you so "document level customizations", can I presume you are referring to Excel Workbook projects and not Excel Addin projects

Thanks in advance.






Re: Visual Studio Tools for Office Binding to collection of objects in Excel 2007 Add-in