473,516 Members | 2,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open Excel file with ASP.Net

Gentlemen,
first of all I have a general question... is it possible to open an
excel file directly through the ASP.NET page without to install Excel
on server?
I tried something on my localhost...
this following code creates an Excel.exe instance in my TaskMgr but I
am not able to make it visible...
I debugged several times through the code. I tested ex.visible
immediately after I set it true... it was still false!!!
Private Sub btnExcel_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnExcel.Click
Dim path As String = AppSettings("Pivotpath") ' "C:\pivot\
path = path & "63.xls" 'dummy
Dim ex As Excel.Application
Dim wb As Excel.Workbook
' Dim ws As Excel.Worksheet
ex = CreateObject("Excel.Application")
wb = ex.Workbooks.Open(path)
ex.Visible = True
'wb = ex.Workbooks.Open(path)
'ws = ex.Worksheets.Item(1)
'ws.Activate()
'ex.Windows(1).Activate()
'ex.Sheets(1).visible = True
'ex.Application.Visible = True
' ex.Visible = Not ex.Visible
' ws = wb.Worksheets(1)
excontrol = True
ex.EnableEvents = False
Me.lblExControl.Text = "true"
Me.lblExControl.Visible = True
' Response.WriteFile(path)
End Sub
thx & regards
Raggie

Apr 10 '06 #1
1 19881
Raggie,

You should not automate excel from a web application. To display it
in the webpage navigate to the xls file.

Here is a link on how to create a spreadsheet in a web application using xml
transformations.

http://support.microsoft.com/default...b;en-us;319180

Ken
----------------
"Raggie" <ra*****@googlemail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
Gentlemen,
first of all I have a general question... is it possible to open an
excel file directly through the ASP.NET page without to install Excel
on server?
I tried something on my localhost...
this following code creates an Excel.exe instance in my TaskMgr but I
am not able to make it visible...
I debugged several times through the code. I tested ex.visible
immediately after I set it true... it was still false!!!
Private Sub btnExcel_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnExcel.Click
Dim path As String = AppSettings("Pivotpath") ' "C:\pivot\
path = path & "63.xls" 'dummy
Dim ex As Excel.Application
Dim wb As Excel.Workbook
' Dim ws As Excel.Worksheet
ex = CreateObject("Excel.Application")
wb = ex.Workbooks.Open(path)
ex.Visible = True
'wb = ex.Workbooks.Open(path)
'ws = ex.Worksheets.Item(1)
'ws.Activate()
'ex.Windows(1).Activate()
'ex.Sheets(1).visible = True
'ex.Application.Visible = True
' ex.Visible = Not ex.Visible
' ws = wb.Worksheets(1)
excontrol = True
ex.EnableEvents = False
Me.lblExControl.Text = "true"
Me.lblExControl.Visible = True
' Response.WriteFile(path)
End Sub
thx & regards
Raggie

Apr 10 '06 #2

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

Similar topics

13
35487
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 and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy...
1
6373
by: Lize | last post by:
Hi, I'm writing an ASP application to open an excel workbook, then run a macro stored in the excel file, which produces outputs that will be displayed back onto my ASP application. Now the problem I'm having is whenever I try to open a workbook (of any format, i.e. 97/2000, 95, or xp, and of any size, and with or without macros), excel...
1
651
by: Sarah | last post by:
Hello. I am using Microsoft.Office.Interop.Excel in a C# .NET project. I want to open an Excel application with a specific file name. I am currently opening it with this code: oXL.Workbooks.Open(src, Type.Missing, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,...
2
447
by: zino | last post by:
I have a file that is created in Excel and saved as an htm file. (if I open the file through Excel it open as Excel file, if I click on the file name it open in internet explorer). I need to read this Excel/htm file but in excel mode through VB.net, in order to have acces to specifc cells and worksheets. how can I do that ? thanks
3
3698
by: VbUser25 | last post by:
hi.. i have a form i accept some user inputs in the form. there is a link on the form from where i open the excel file in the same browser (not in a new page...simply using a href. i am also accepting input from the user in the excel. now i want to save the data in excel as well as on asp form. i can save directly thru vba code in...
3
7415
by: Jennyfer Barco | last post by:
Hello, I have a question, how can I open Microsoft Excel from .NET. I only need to open a new file in Excel and paste some information and set the Microsoft Excel as the enabled aplication, so the user can continue working in Excel and he'll save the information I pasted. I tried this but doesn't open Excel at all, but it does save the file...
4
11935
by: JaxDawg | last post by:
I have a spreadsheet saved as an XML spreadsheet so I can manipulate it easier (and don't need COM). When I'm done, I want to display to the user. Currently, I'm using simple JavaScript in my PHP file to display the file when complete: echo '<script type="text/javascript"window.open("'.$file_nm.'")</ script>'; Since the file is .XML,...
8
9621
by: shenkel55 | last post by:
I'm using Access and Excel 2003. Using either the import wizard or code, I have the same problem. This problem only happens with Excel files automatically generated by Corp IT. If I try to do an import and the Excel file isn't open I get the following error: "The wizard is unable to access information in the file "...path info... "Please check...
7
3992
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
22
68565
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses Microsoft.Office.Interop.Excel.Application to access an Excel file on the local hard drive, opens it (using Application.Workbooks.Open), reads out some data and the provides said...
0
7276
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7142
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.