ASPX and MS Office Automation

G

Guest

Hi. I've seen several KBs on using .NET for MS Office Automation. But I have
a particular question: I am developing a somewhat stand-alone .ASPX page
which will need to do some relatively simple MS Office Automation (Office
2003+).

The .ASPX page is not part of a Web Forms Visual Studio project. It's just a
stand-alone file. And therefore, there is not "References" setting or
anything because there's no Visual Studio project.

My question is, can I use various <% @ Import Namespace=... %> directives to
include the proper references? In other words, is there a way to have
references included in an .ASPX page so that when ASPX automatically compiles
it, it'll have the right references?

If so, can you tell me what directives I need to include (seems like some
interop stuff is needed too, right?) at the top of my .ASPX file so that
things'll work?

Thanks.

Alex Maghen
 
K

Ken Cox [Microsoft MVP]

Hi Alex,

If you aren't working in the VS.NET IDE, you need to add references when you
compile, for example:

vbc /debug /nologo /t:library /out:bin/DataLayer.dll /r:System.dll
/r:System.Xml.dll /r:System.Web.dll /r:System.Data.dll Datalayer.vb

There's info here on doing ASP.NET without VS.NET but using Web Matrix:

http://www.asp.net/webmatrix/web matrix_doc.pdf

Ken
 
G

Guest

Alex...

You mentioned that you've read some KB articles on automating Office from
..NET. Be sure you read KB article #257757 - "Considerations for server-side
automation of office" and other material that that article refers to. One
thing you will learn is that Microsoft does not recommend or support what you
(evidently) are planning to do.

There are many reasons for this recommendation that are spelled out in the
article. What I can tell you from my own practical experience is that, in
addition to inherent risks to both the security and stability of your
application, you're probably going to find that you need to come up with some
means of single-threading your automated processes. This may not be an issue
if you have an extremely small user-base. In fact, we have succedded in
building several application that support very small user communities using
both Word and Excel - but it's proven to be a real pain in the patoot.

Consider using OfficeWriter, or some other third-party product designed
specifically for the kind of appication you are building. Also consider the
fact that if you code your app to do Office Automation, you will end up
re-coding the whole thing if you decide to use OfficeWriter after learning
the hard way that it ain't gonna fly.

Good Luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top