473,406 Members | 2,467 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.

Write to an Excel file

Hello,
I'm trying to figure out how to do the above. I'm using a snippet of code I
found on the net (see below). My problem is when I hit the line (oXL = new
Excel.Application();) I get an exception which says..."Access is Denied".
Does anyone know what I'm doing wrong?

string strFileName = null;
string fileName = "Hockey";
Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet oSheet;

oXL = new Excel.Application();
oXL.Visible = false;
oWB= (Excel._Workbook)(oXL.Workbooks.Add( Missing.Value ));
oSheet = (Excel._Worksheet)oWB.ActiveSheet;
oSheet.Cells[1,1]="this is a test value";
((Range)oSheet.Cells[1,1]).ColumnWidth = 45;
((Range)oSheet.Cells[1,1]).EntireColumn.WrapText=true;
oWB.SaveAs(fileName,Excel.XlFileFormat.xlWorkbookN ormal, null, null,false,
false, Excel.XlSaveAsAccessMode.xlShared, false, false, null,
null, null);
// Below line will kill the unkilled Excel process

Process[] pProcess;
pProcess = System.Diagnostics.Process.GetProcessesByName("Exc el");
pProcess[0].Kill();

oSheet= null;
oWB = null;
oXL = null;
Nov 17 '05 #1
2 1969
I found some information on the net that talked about having to handling
user rights to spawn Excel through the <identity> tag in the web.config
file?
Does anyone know what this is about?
Nov 17 '05 #2
which line is dying?

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"Randy" <te**@temp.com> wrote in message
news:eD**************@TK2MSFTNGP10.phx.gbl...
I found some information on the net that talked about having to handling
user rights to spawn Excel through the <identity> tag in the web.config
file?
Does anyone know what this is about?

Nov 17 '05 #3

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

Similar topics

0
by: Pauravi | last post by:
Hi I want to export web controls value into the Excel file. Detail : I have a text box where user can type the filename and on click of button a dialog box should appear that will ask user to...
0
by: Zed | last post by:
I have a problem with .net writing to a remote server that I need to deploy on. The app works fine on my local machine. But when got access to the server I went to VS.NET and tried to create a...
0
by: Katie | last post by:
Our ASP.NET app produces a page in excel format using Response.ContentType = "application/vnd.ms-excel" Response.Write(strExcel) (where strExcel is a tab and carriage return delimited string) ...
1
by: sweety | last post by:
Hi, Very Urgent... I Need to write a structure of data which is in "C" to excel file(*.xls). So, using C/VC++ how i can create a Excel file and how i can write a data into the respective...
4
by: Seok Bee | last post by:
Dear Experts, I have created a script to extract the Event Logs from the system into an excel sheet. The logs are separated into 2 worksheets (Application Log and System Log). After this excel...
0
by: suryar | last post by:
Hi please help me some one in my company i want to write a script in vb to write a text file but the source file is an excel file i want write a text or dat file with fixed lengths maping with ...
0
by: mady1380 | last post by:
hi all i am trying to read and write data in Excel file from asp.net I am able to read the data of particular cell, but i am not able to write in Excel file. I am getting error:...
0
by: newUser1234 | last post by:
I'm trying to read and write from an excel file using this method..My application can read the excel file without problems but doesn't write anything to the file i want it to write. I've also tried...
12
by: Reggie | last post by:
Hi And TIA. Running VS2005 and IIS7.0. I have a procedure that copies a file to a folder in my web application. When I run the project from VS it runs fine . I'm usin IE as default viewer. But...
8
blazedaces
by: blazedaces | last post by:
So I have a program below which writes an excel file with multiple sheets based on inputs of sheet names, data, cell types, etc. It uses Apache POI, which is currently the only thing I found...
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
0
BarryA
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...
1
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...
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
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...
0
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,...
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
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.