Hi,
My client has asked me to provide a "quick and dirty" way to export the
contents of a DataGrid to both Excel for analysis and Word for editing and
printing, so I'm investigating client-side automation.
N.B. the environment is a totally enclosed intranet, all the client machines
have WinXP, IE6 and Office Pro 2003 with all the latest SPs, and the IE
security settings are sufficient to allow the Local Intranet Zone to
instantiate Word & Excel. Therefore, there's no need for any 3rd-party tools
like Aspose or whatever in this case.
I found the following extremely helpful site: http://www.aspnetpro.com/NewsletterA...200309so_l.asp
which demonstrates a method of client-side Excel automation using VBScript.
It also says that it's possible to automate Word in a similar way by
changing a couple of lines, but doesn't say which lines they are or how to
modify them.
I'm also trying to write the client-side automaton in JavaScript rather than
VBScript, though there would be no harm I suppose in keeping it in VBScript.
This is how far I've got:
function exportReport(pstrOutput, strHTML)
{
switch(pstrOutput)
{
case 'Excel' :
{
var objXL = new ActiveXObject("Excel.Application");
var objWB = objXL.Workbooks.Add;
objWB.HTMLProject.HTMLProjectItems('Sheet1').Text = strHTML;
objWB.HTMLProject.RefreshDocument;
objXL.Visible = true;
objXL = null;
}
case 'Word' :
{
}
}
}
This works well enough. Two questions:
1) This always leaves an instance of EXCEL.exe running even if the user
closes Excel down manually - is there a way round this?
2) Does anyone know how to do the equivalent Word automation?
Any assistance gratefully received.
Mark 6 2372
I know its scarry....but its this easy.....
Change your page's content-type to word or excel....
Then render the page normally
oh....here's a list of some content types: http://www.usf.uni-osnabrueck.de/inf...wwfaq/mime.htm
"Mark Rae" wrote: Hi,
My client has asked me to provide a "quick and dirty" way to export the contents of a DataGrid to both Excel for analysis and Word for editing and printing, so I'm investigating client-side automation.
N.B. the environment is a totally enclosed intranet, all the client machines have WinXP, IE6 and Office Pro 2003 with all the latest SPs, and the IE security settings are sufficient to allow the Local Intranet Zone to instantiate Word & Excel. Therefore, there's no need for any 3rd-party tools like Aspose or whatever in this case.
I found the following extremely helpful site: http://www.aspnetpro.com/NewsletterA...200309so_l.asp which demonstrates a method of client-side Excel automation using VBScript. It also says that it's possible to automate Word in a similar way by changing a couple of lines, but doesn't say which lines they are or how to modify them.
I'm also trying to write the client-side automaton in JavaScript rather than VBScript, though there would be no harm I suppose in keeping it in VBScript. This is how far I've got:
function exportReport(pstrOutput, strHTML) { switch(pstrOutput) { case 'Excel' : { var objXL = new ActiveXObject("Excel.Application"); var objWB = objXL.Workbooks.Add; objWB.HTMLProject.HTMLProjectItems('Sheet1').Text = strHTML; objWB.HTMLProject.RefreshDocument; objXL.Visible = true; objXL = null; } case 'Word' : {
} } }
This works well enough. Two questions:
1) This always leaves an instance of EXCEL.exe running even if the user closes Excel down manually - is there a way round this?
2) Does anyone know how to do the equivalent Word automation?
Any assistance gratefully received.
Mark
"David Jessee" <Da*********@discussions.microsoft.com> wrote in message
news:4C**********************************@microsof t.com... I know it's scary....but it's this easy.....
Change your page's content-type to word or excel....
Then render the page normally
See below - I need to *open* Excel and/or Word, not render MIME types in
IE...
oh....here's a list of some content types: http://www.usf.uni-osnabrueck.de/inf...wwfaq/mime.htm
"Mark Rae" wrote:
Hi,
My client has asked me to provide a "quick and dirty" way to export the contents of a DataGrid to both Excel for analysis and Word for editing and printing, so I'm investigating client-side automation.
N.B. the environment is a totally enclosed intranet, all the client machines have WinXP, IE6 and Office Pro 2003 with all the latest SPs, and the IE security settings are sufficient to allow the Local Intranet Zone to instantiate Word & Excel. Therefore, there's no need for any 3rd-party tools like Aspose or whatever in this case.
I found the following extremely helpful site: http://www.aspnetpro.com/NewsletterA...200309so_l.asp which demonstrates a method of client-side Excel automation using VBScript. It also says that it's possible to automate Word in a similar way by changing a couple of lines, but doesn't say which lines they are or how to modify them.
I'm also trying to write the client-side automaton in JavaScript rather than VBScript, though there would be no harm I suppose in keeping it in VBScript. This is how far I've got:
function exportReport(pstrOutput, strHTML) { switch(pstrOutput) { case 'Excel' : { var objXL = new ActiveXObject("Excel.Application"); var objWB = objXL.Workbooks.Add; objWB.HTMLProject.HTMLProjectItems('Sheet1').Text = strHTML; objWB.HTMLProject.RefreshDocument; objXL.Visible = true; objXL = null; } case 'Word' : {
} } }
This works well enough. Two questions:
1) This always leaves an instance of EXCEL.exe running even if the user closes Excel down manually - is there a way round this?
2) Does anyone know how to do the equivalent Word automation?
Any assistance gratefully received.
Mark
Have you tried this free ExportPanel control? http://SteveOrr.net/articles/ExportPanel.aspx
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:eB**************@TK2MSFTNGP05.phx.gbl... Hi,
My client has asked me to provide a "quick and dirty" way to export the contents of a DataGrid to both Excel for analysis and Word for editing and printing, so I'm investigating client-side automation.
N.B. the environment is a totally enclosed intranet, all the client machines have WinXP, IE6 and Office Pro 2003 with all the latest SPs, and the IE security settings are sufficient to allow the Local Intranet Zone to instantiate Word & Excel. Therefore, there's no need for any 3rd-party tools like Aspose or whatever in this case.
I found the following extremely helpful site: http://www.aspnetpro.com/NewsletterA...200309so_l.asp which demonstrates a method of client-side Excel automation using VBScript. It also says that it's possible to automate Word in a similar way by changing a couple of lines, but doesn't say which lines they are or how to modify them.
I'm also trying to write the client-side automaton in JavaScript rather than VBScript, though there would be no harm I suppose in keeping it in VBScript. This is how far I've got:
function exportReport(pstrOutput, strHTML) { switch(pstrOutput) { case 'Excel' : { var objXL = new ActiveXObject("Excel.Application"); var objWB = objXL.Workbooks.Add; objWB.HTMLProject.HTMLProjectItems('Sheet1').Text = strHTML; objWB.HTMLProject.RefreshDocument; objXL.Visible = true; objXL = null; } case 'Word' : {
} } }
This works well enough. Two questions:
1) This always leaves an instance of EXCEL.exe running even if the user closes Excel down manually - is there a way round this?
2) Does anyone know how to do the equivalent Word automation?
Any assistance gratefully received.
Mark
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uf*************@TK2MSFTNGP02.phx.gbl...
Hi Steve, Have you tried this free ExportPanel control? http://SteveOrr.net/articles/ExportPanel.aspx
I haven't, though I'm sure it's fab. I will be sure to check it out ASAP.
However, in the meantime, what I'd really love to know relates to your
excellent web article
(http://www.aspnetpro.com/NewsletterA...00309so_l.asp),
specifically where you say:
Figure 7. Modify a couple of code lines, and voila! - your data is now
output as a Word document instead of Excel.
What actually are the couple of code lines in question, and what are the
modifications required?
Also, if you have time, do you happen to know if there is a way to stop the
code always leaving an instance of EXCEL.exe (and, I imagine, WINWORD.exe)
running even if the user closes Excel down manually?
Thanks a lot.
Mark
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message news:eB**************@TK2MSFTNGP05.phx.gbl... Hi,
My client has asked me to provide a "quick and dirty" way to export the contents of a DataGrid to both Excel for analysis and Word for editing and printing, so I'm investigating client-side automation.
N.B. the environment is a totally enclosed intranet, all the client machines have WinXP, IE6 and Office Pro 2003 with all the latest SPs, and the IE security settings are sufficient to allow the Local Intranet Zone to instantiate Word & Excel. Therefore, there's no need for any 3rd-party tools like Aspose or whatever in this case.
I found the following extremely helpful site: http://www.aspnetpro.com/NewsletterA...200309so_l.asp which demonstrates a method of client-side Excel automation using VBScript. It also says that it's possible to automate Word in a similar way by changing a couple of lines, but doesn't say which lines they are or how to modify them.
I'm also trying to write the client-side automaton in JavaScript rather than VBScript, though there would be no harm I suppose in keeping it in VBScript. This is how far I've got:
function exportReport(pstrOutput, strHTML) { switch(pstrOutput) { case 'Excel' : { var objXL = new ActiveXObject("Excel.Application"); var objWB = objXL.Workbooks.Add; objWB.HTMLProject.HTMLProjectItems('Sheet1').Text = strHTML; objWB.HTMLProject.RefreshDocument; objXL.Visible = true; objXL = null; } case 'Word' : {
} } }
This works well enough. Two questions:
1) This always leaves an instance of EXCEL.exe running even if the user closes Excel down manually - is there a way round this?
2) Does anyone know how to do the equivalent Word automation?
Any assistance gratefully received.
Mark
The couple of lines are referring to the HTML output option. Both the Word
and Excel code is shown in the article for that option.
As for client side techniques, I haven't tried to output Word from the
client side, but I imagine the code would require slightly more significant
changes than the server side HTML output code. For the client side code
you'd need to use Word's object model instead of Excel so you wouldn't be
creating worksheets, you'd be creating documents & such.
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl... "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message news:uf*************@TK2MSFTNGP02.phx.gbl...
Hi Steve,
Have you tried this free ExportPanel control? http://SteveOrr.net/articles/ExportPanel.aspx
I haven't, though I'm sure it's fab. I will be sure to check it out ASAP.
However, in the meantime, what I'd really love to know relates to your excellent web article (http://www.aspnetpro.com/NewsletterA...00309so_l.asp), specifically where you say: Figure 7. Modify a couple of code lines, and voila! - your data is now output as a Word document instead of Excel.
What actually are the couple of code lines in question, and what are the modifications required?
Also, if you have time, do you happen to know if there is a way to stop the code always leaving an instance of EXCEL.exe (and, I imagine, WINWORD.exe) running even if the user closes Excel down manually?
Thanks a lot.
Mark
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> wrote in message news:eB**************@TK2MSFTNGP05.phx.gbl... Hi,
My client has asked me to provide a "quick and dirty" way to export the contents of a DataGrid to both Excel for analysis and Word for editing and printing, so I'm investigating client-side automation.
N.B. the environment is a totally enclosed intranet, all the client machines have WinXP, IE6 and Office Pro 2003 with all the latest SPs, and the IE security settings are sufficient to allow the Local Intranet Zone to instantiate Word & Excel. Therefore, there's no need for any 3rd-party tools like Aspose or whatever in this case.
I found the following extremely helpful site: http://www.aspnetpro.com/NewsletterA...200309so_l.asp which demonstrates a method of client-side Excel automation using VBScript. It also says that it's possible to automate Word in a similar way by changing a couple of lines, but doesn't say which lines they are or how to modify them.
I'm also trying to write the client-side automaton in JavaScript rather than VBScript, though there would be no harm I suppose in keeping it in VBScript. This is how far I've got:
function exportReport(pstrOutput, strHTML) { switch(pstrOutput) { case 'Excel' : { var objXL = new ActiveXObject("Excel.Application"); var objWB = objXL.Workbooks.Add; objWB.HTMLProject.HTMLProjectItems('Sheet1').Text = strHTML; objWB.HTMLProject.RefreshDocument; objXL.Visible = true; objXL = null; } case 'Word' : {
} } }
This works well enough. Two questions:
1) This always leaves an instance of EXCEL.exe running even if the user closes Excel down manually - is there a way round this?
2) Does anyone know how to do the equivalent Word automation?
Any assistance gratefully received.
Mark
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:up**************@TK2MSFTNGP02.phx.gbl... The couple of lines are referring to the HTML output option. Both the Word and Excel code is shown in the article for that option.
As for client side techniques, I haven't tried to output Word from the client side, but I imagine the code would require slightly more significant changes than the server side HTML output code. For the client side code you'd need to use Word's object model instead of Excel so you wouldn't be creating worksheets, you'd be creating documents & such.
Ah yes - it's the client-side code for Word I was referring to...
S'OK - I figured it out, and in JavaScript too.
Incidentally, do you know if there any way to prevent the instance of
Excel.exe / Winword.exe persisting even after the user has closed either
app, and even closed their browser...? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Beowulf |
last post by:
Hi,
I have an XML file generated by a third party (and therefore
unchangable) program.
1st line in it is <?xml version="1.0" encoding="us-ascii"?> and down
in the depths of the xml I have a...
|
by: Bob N5 |
last post by:
I am working on an application that uses interop to do some simple operations
with both Excel and Word. I have most of functionality working, but ran into
issues on making things work with both...
|
by: Midas NDT Sales |
last post by:
Hopefully this is a simple question.
I am trying to output a report from Access to Word, everything goes OK
except the graphics.
How can you get Access to output the graphics (a logo and a few...
|
by: Bernd Muent |
last post by:
Hi together,
I am using the following code in Visual Basic to open Word or Excel
applications:
Word:
Dim w As Word.Application
w = CType(CreateObject("Word.application"), Word.Application)...
|
by: Derek |
last post by:
I have a simple app that logs details of my customers and the work done for
them. It uses a few tables in Access and allows me to keep a basic record of
things for my accountant.
How can I...
|
by: The Night Blogger |
last post by:
Is there a way to push data to Microsoft Excel & Word from a Python
Application
Is this a cross platform feature ? I'll need to push data on MS Windows &
Mac OS X ....
|
by: et |
last post by:
I am trying to follow
http://msdn2.microsoft.com/en-us/library/aa701256(office.11).aspx#Office2003Integratingwithaspnet20_CreatingtheWord2003DocumentTemplate
which appears to be absolutely useless...
|
by: =?Utf-8?B?VGhvbWFzLVZD?= |
last post by:
Hello,
I am looking for specific information and sample code on the following:
I would like to know how I can use Excel and Word within (!) my C#
application. I would like to create a form with...
|
by: deve8ore |
last post by:
Hello,
I have a Word document called (), a named range that will
open up a new Word doc dependent on what a user selects in Excel.
Could someone please guide me on how to set up VBA code to...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |