index > Visual Studio Tools for Office > NamedRange Binding

NamedRange Binding


is it possible to bind a NamedRange spanning over multiple columns to a collection or datatable having several columns or properties.

From what I read till now the binding of a namedrange is only to 1 field.

NamedRange.Databinding.Add("Value2",datasource,"1column")

can anyone help?

sam8sam
Hope this helps, if I am understanding you correctly. If nothing else it may enlighten you on how to do what you need..

In this code I take a dataset and paste it into Excel. The data has multiple colums.1 Note TheSheet
OmegaMan

Thank you for the reply. I already know this option. I mean to loop through all records and do whatever to set the Value2 property of the namedrange.

In fact I am seeking a binding solution that will be faster and will reflect the changes automatically to the datatable or collection. In your example you are just displaying the data but what if you wanted to give the user the choice of editing??? you will have to keep track of changes and reflect them on the source....

sam8sam

Hi "sam"

I believe a NamedRange can be bound only to a single field (column), yes. You can use a ListObject to bind to multiple columns.

I'm having difficulty envisioning a scenario where you'd want to bind to multiple columns. But theoretically you should be able to change the binding of a NamedRange to a different column? I think that would be your only possibility, outside of not using automatic binding at all.




-- Cindy Meister (Word MVP)
Cindy Meister
reply 4

You can use google to search for other answers

 

More Articles

Excel/Streamwriter/Kludgy NamedRange access
Login control into VSTO/Excel
Need Help: Suggest an approach!!
Redistribute VSTO Problem
.net COM Add-in for Excel - cannot find Extensibility Projects
How to get a reference to Word.BuildingBlocks interface on the fl...
VSTO-2 (2003) Word Template code-behind assembly doesn't run
IrtdServer - Real time Data Server - not working on .Net version ...
WebService and VSTO project, on diff. machines and planets
Outlook Winform
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Threading and Word
How to control the cell's datatype of Ex…
connectivity issues outlook 2003
Outlook Add-in
How to use Office commandbar objects in …
Shared AddIn Problem
Missing measure in a privotchart "d…
Is it possible to link project # 1 to pr…
New Workbook
Create an action pane to all words docum…
Naming of manifest files
Where can I download Cypress?
File Download feature in ASP.NET
Range.InsertParagraphBefore avoiding the…
Printing a MS Access report

Hot Articles

HHC6003: Error: The file Itircl.dll has …
MSProject VS Interop problems
Excel Solver macro from VB.NET
Problem with word automation in deleting…
check to see if the sent mail is a reply…
problems re - opening .xsn with the info…
How is this code (VBA6.0 with Excel Appl…
Visual Studio Version
Running a Word VSTO Project - What steps…
how to publish vsto word document in to …
Create a "Bare" Workbook From …
DefaultSorting Bookmarks
Creating word template with bookmarks. i…
saving User Control state of control emb…
Developing excel VSTO solution on network?

Recommend Articles

Smart-tag in Outlook?
Outlook: no Add-In does load anymore
How to Hide controls during printing or …
Embed and Automate a Word Document by Us…
COM object with CLSID {...} is either no…
Excel 2003 called from an webservice
Outlook custom action in Rules Wizard
Question re Cypress
What do I need?
MSProject VS Interop problems
Can I save information inside a Word Doc…
VSTO 2005- Word : Intercepting hyperlink…
Excel Sheet Switching/Hiding
Adding comandbar to RichText Inspector c…
how to add xml markup to a range