|
| Passing parameters to a VSTO document? |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.vsnet.vstools.office.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| Rohan Cragg via .NET 247 (VIP) |
| GOOD ANSWER |
http://dotnetjunkies.com/WebLog/rohancragg
As you will see from my first blog entry, I have been playing with VSTO and loving it. My one big question which I can't seem to get my head round is as follows.
I already know I can open a new document from a template and run some code (with VSTO), but is there any way I could possibly pass in a parameter from somewhere so that code-behind can fill some relevant data for me.
The example scenario would be that I have a page on the CRM section of our intranet showing a client's details, and I want to provide a 'new letter to this client' hyperlink. I could write a winforms app hosted in IIS to act as a go-between and pick the parameter up from the QueryString but is there a better way where I can stay within the VSTO way of doing things?
-------------------------------- From: Rohan Cragg
----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>p8hwB7EqE0KOqDrLXxMajg==</Id>
|
|
|
| |
|
|
| |
| |
| Iouri Simernitski (MS) |
| GOOD ANSWER |
Hi Rohan, welcome to VSTO!
This kind of solution was implemented in the Estimates VSTO sample where Excel invokes Word and passes data to it. Both Excel and Word use VSTO code-behind. The approach used there was to create a word document, set custom properties and call document.Activate. In the Word document's code-behind, the Open event only hooks up the Activate event. The handler for Activate has all the actual processing (and also unhooks itself, so that the code is only run on the first Activate).
In your case, I would automate Word through client-side scripting (JScript or VBScript). Putting a hyperlink to a Word project not only makes it hard to pass data (because no code runs to push the data to Word), but has other limitations - see recent thread "REPOST: Code behind events are not firing" for more details. You will also notice that word does not accept templates that have HTTP addresses. You will have to either implement your template as a document or access it through UNC (e.g. \\myserver\share\file.dot).
Hope this helps, iouri
---------- This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
| |
|
|
| |
| |
| Nancyb |
| GOOD ANSWER |
Hi Iouri, This seems like a silly question, but where can I find the files for this sample? I found the link to the Estimates sample... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wroriendtoendsolutionsample.asp ....but now don't know where to find the 'Sample Files box' that it says I need to click. This is what it says in the 'To build the sample' section. "In the Sample Files box in this topic, click Copy All Files and specify where you want to save the files."
Thanks in advance. I'd really like to try out this sample.
|
|
|
| |
|
|
| |
| |
| Howard Kaikow |
| GOOD ANSWER |
The Estimates Sample description and files are in the MSDN library that was installed with VS .NET 2003. Appears to need a Web Server to load the solution.
-- http://www.standards.com/; See Howard Kaikow's web site. "Nancyb" <Click here to reveal e-mail address> wrote in message news:Click here to reveal e-mail address... [Original message clipped]
"In the Sample Files box in this topic, click Copy All Files and specify where you want to save the files." [Original message clipped]
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|