473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ASP.NET - Trying to spin off an Excel worksheet with IIS

Hello,

I've been trying to spin off an Excel worksheet on the client from an
ASP.NET website. I was successfull in displaying an Excel worksheet on
the client in a test website (not using IIS, but using Visual Studio
2005) with the following code:

protected void Button1_Click(object sender, EventArgs e)
{
Application exc = new Application();

exc.Visible = true;

Workbooks workbooks = exc.Workbooks;

_Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet);

Excel.Worksheet worksheet = (Excel.Worksheet)workbook.ActiveSheet;
}

This code spins off a blank Excel worksheet.

However when I place this code into another ASP.NET website that I'm
developing, I find that I can't set exc.Visible = true! The Excel
worksheet doesn't display at all. The only difference is that the new
ASP.NET website is run off of IIS and the test website is run off the
local Visual Studio 2005.

What am I doing wrong?

Thanks!

Steve

Jul 16 '07 #1
2 2290
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11*********************@w3g2000hsg.googlegrou ps.com...
What am I doing wrong?
You're trying to use server-side Office automation - this doesn't work:
http://support.microsoft.com/default...US;q257757#kb2

Fortunately, there are several other options, depending on what you're
trying to do. Can you please tell us your requirements, and also maybe
explain what you mean by "spin off" an Excel worksheet...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 16 '07 #2
Office automation bits are not designed to work in web applications. If you
want to pop things up as Excel, you have three options I can think of

1. Create a page with an HTML table and change the MIME type to Excel. Poor
man's way
2. Use a third party component to create the excel spreadsheet as a file
(this can be streamed or saved and linked)
3. Use the office components to do the same as #2

I do not recommend #3. And, #1 is only useful for simple spreadsheets (data
reports, for example). There are various office writer type components that
are much lighter than the office bits, so I would use #2 to create files.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)

************************************************
Think outside the box!
************************************************
"Steve Kershaw" <st***********@yahoo.comwrote in message
news:11*********************@w3g2000hsg.googlegrou ps.com...
Hello,

I've been trying to spin off an Excel worksheet on the client from an
ASP.NET website. I was successfull in displaying an Excel worksheet on
the client in a test website (not using IIS, but using Visual Studio
2005) with the following code:

protected void Button1_Click(object sender, EventArgs e)
{
Application exc = new Application();

exc.Visible = true;

Workbooks workbooks = exc.Workbooks;

_Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet);

Excel.Worksheet worksheet = (Excel.Worksheet)workbook.ActiveSheet;
}

This code spins off a blank Excel worksheet.

However when I place this code into another ASP.NET website that I'm
developing, I find that I can't set exc.Visible = true! The Excel
worksheet doesn't display at all. The only difference is that the new
ASP.NET website is run off of IIS and the test website is run off the
local Visual Studio 2005.

What am I doing wrong?

Thanks!

Steve

Jul 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
1
by: c duden | last post by:
Excel won't allow documents to be linked to a worksheet in office 2000 when using C# to create an add-in. The following code snippets are what was used in the attempts (there are more...
1
by: mail2atulmehta | last post by:
Hi, I do not know if this is right place for this, but i need some help. I have a text file, whose values are seprated by a delimiter. I want to open this file in excel, ( not import it) . I have...
2
by: Kumar | last post by:
Hi Folks, I have a question regarding my windows c# application. This application just reads MS Excel file and puts the data in to sql server database. In that excel file ,it has one named cell...
0
by: dgoel | last post by:
Hi, I Have a text file & I want to open it in excel sheet ( withou importing). I have written code for it, but it is not opening exce sheet. It opens the text file, but does not create a excel...
1
by: javzxp | last post by:
Hi I'd like to use C# to open an existing Excel workbook and save each worksheet it contains into a new Excel file. The name of each new Excel file should be the name of the worksheet copied...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
8
by: Sam | last post by:
Hi All, I posted this message few days ago. No one has answered so far. I just would like to know if it is possible to do or not. Even if you can not tell me how to do this, maybe you know which...
1
by: Randall Arnold | last post by:
I'm converting a vbscript program to vb.net. Witht he exception of .net idiosyncrasies, most of it is working well with the same code. My only problem is that some properties and methods are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.