Friday, March 23, 2012

open xml output in word

I has a sproc that creates xml output using 'Select ... for xml', but I want
my code to automatically open it in Word, so the user will see the output in
word and can save it whereever they want. I tried the xp_cmdShell (after
enabling it) - either I'm not using it correctly or something.
This is what I'm doing:
declare @.RV as integer
exec @.rv = uspCatalogtoXML
xp_cmdshell 'word.exe ' + @.RV
but I know the xp_cmdShell line is wrong.
Anyone help?
Reference: http://support.microsoft.com/kb/210565
2000,2003
Reference: http://office.microsoft.com/en-us/word/HP101640101033.aspx
2007
Depending on what version of word you will need to navigate to the proper
folder and the use the winword.exe...
example :xp_cmdshell 'C:\Program Files\Microsoft Office\Office\Winword.exe
/a /w'
Problem is, I do not believe you can pass in an XML file for 2000 or 2003.
In 2007 you can use the /pxslt sitch but you will have to save the xml and
the xslt as a file first.
/*
Warren Brunk - MCITP,MCTS,MCDBA
www.techintsolutions.com
*/
"Jane" <Jane@.discussions.microsoft.com> wrote in message
news:DC26E85E-CFFC-4A63-9989-C361B84634E0@.microsoft.com...
>I has a sproc that creates xml output using 'Select ... for xml', but I
>want
> my code to automatically open it in Word, so the user will see the output
> in
> word and can save it whereever they want. I tried the xp_cmdShell (after
> enabling it) - either I'm not using it correctly or something.
> This is what I'm doing:
> declare @.RV as integer
> exec @.rv = uspCatalogtoXML
> xp_cmdshell 'word.exe ' + @.RV
> but I know the xp_cmdShell line is wrong.
> Anyone help?
>

No comments:

Post a Comment