Manipulate Bookmarks @ Server Side
[Using VSTO 2005 Beta 2]I am looking for a way to change text within Word Bookmark controls at the server.
I am aware of accessing the Cached objects within the Word Manifest and for instance fill a Cached Dataset with the information that I want to show in bookmarks.
What I would like to know is if it's possible to change bookmark information directly using a ServerDocument.
The Other thing, is it possible to databind Bookmark controls to a cached data object so that changing data in the cached object is enough to change de bookmark contents?
The reason for all of this is that the information is at hand at the serverside and it is needed that no further processing is needed at the client side.
-= Maarten =-
http://blogs.officezealot.com/maarten
I was able to insert a cached dataset and update the dataset as ServerDocument.
The binding was set programmatically and enabled the update of the bookmark in the document.
What I did is:
Add a cached dataset to the ThisDocument class:
[Cached()] public DataSet myDS;and set the binding in the ThisDocument_Startup:
private void ThisDocument_Startup(object sender, System.EventArgs e)
{
if (myDS == null)
{
myDS = new DataSet();
DataTable myTable = new DataTable("Table1");
myTable.Columns.Add("Column1", typeof(string));
myDS.Tables.Add(myTable);
}
bookmark1.DataBindings.Add("Text", myDS, "Table1.Column1", true);
}
A new question that came to me was:
Is it possible to make the Databinding persistent instead of setting this each time at Startup? If so how/where?
In fact that was what I tried first. Adding the bookmark and enter the binding in the properties pane. The properties pane however refused to accept the params to bind to the Cached dataset. That's why I added the binding code in the initialize on the document...Maybe I missed how to do that in design time...
The point is that the datasource is only a 'placeholder' until accessed and filled using the ServerDocument interface.
-= Maarten =-
The dataset is situated (see my earlier post) in the ThisDocument class and is created one time. All other manipulations will be done externally by streaming the xml data into the document using the ServerDocument interfaces.
Thanks for your support, it helped me create a nice demo.
-= Maarten =-