Database Binding in VSTO with Word..
Requirement:-
Vs(2008)
Vsto Tool
Sqlserever
and Interest
Create Database Myprofiletest having Follwing Fileds..
Srno
Name
Sex
Address
Profession
Know Let Start With Visual Studio
1}
Create Simple Table in word which have Name,Address,Sex,Profession and put as header in Table TD.
2}
Know select Datasource from Data menu from Top.
3}
When u Click datasource u will see 3 option
4}
Know select Database and complete Procedure to Connecting and Creating Connection String
5}
Once u connected properly u Given Oprtion Select select Table u have Created
6}
U will Filed in Datasoursce Tab it will map it self with control example if text it will Give Text and datTime then Picker Control.. Etc
7}
Drag and Drop The filed where u want
8}
When u Run Output u will See..
9}
if want Chk Some and put message and on Event of That
private void plainTextContentControl2_Entering(object sender, Microsoft.Office.Tools.Word.ContentControlEnteringEventArgs e)
{
// Display the dialog window for the edit operation
System.Windows.Forms.DialogResult myResult = new DialogResult();
// Message with Yes/No option to proceed
myResult = MessageBox.Show("Do you want to UnLock?", " Address?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly, false);
// If you select the no it will remain in lock mode and display the content
if (myResult == DialogResult.Yes)
plainTextContentControl2.LockContentControl = false;
}
chk the above code
Saturday, May 15, 2010
Subscribe to:
Post Comments (Atom)
VSTO: adding data to table using office word
ReplyDeletei connected to database using datasource object. added object to the table, but i am able to see one record. even in that table it have more than one record. what is the problem.