473,407 Members | 2,326 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,407 software developers and data experts.

Inserting Value at cell in Excel2003

I have an existing excel file & i would like to enter a specific value at
cell A1 in Excel2003 using asp.net 2.0 how can i do this?
Mar 15 '06 #1
3 1799
Hello,

You could try the following code.

Uses Excel;

Excel.Application excelApp = new Excel.ApplicationClass(); // create a new
Excel Application instance
excelApp.Visible = false; // set this property to true if you want the
excel window to popup
Excel.Workbook newWorkbook = excelApp.Workbooks.Open("test.xls", 0, false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
//replace test.xls with your own workbook path
Excel.Sheets excelSheets = newWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet );
Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("A1", "A1");
excelCell.Value2 = "Timesheet for weekending " + cmbWeekEnd.Text + " (" +
cmbDepartment.Text + ")";
excelCell.Font.Size = 12;
excelCell.Font.Bold = true;

Dont forget to add a reference to the excel object library and
Microsoft.Office.Core

Regards
Scott Blood
C# Developer

"nagen" <na***@suriamsc.com> wrote in message
news:er***************@TK2MSFTNGP10.phx.gbl...
I have an existing excel file & i would like to enter a specific value at
cell A1 in Excel2003 using asp.net 2.0 how can i do this?

Mar 15 '06 #2
i had added the assemblies but still unable to locate the Excel from using
keyword
how?

"scott blood" <sc*********@hotmail.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
Hello,

You could try the following code.

Uses Excel;

Excel.Application excelApp = new Excel.ApplicationClass(); // create a
new Excel Application instance
excelApp.Visible = false; // set this property to true if you want the
excel window to popup
Excel.Workbook newWorkbook = excelApp.Workbooks.Open("test.xls", 0, false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
//replace test.xls with your own workbook path
Excel.Sheets excelSheets = newWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet );
Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("A1", "A1");
excelCell.Value2 = "Timesheet for weekending " + cmbWeekEnd.Text + " (" +
cmbDepartment.Text + ")";
excelCell.Font.Size = 12;
excelCell.Font.Bold = true;

Dont forget to add a reference to the excel object library and
Microsoft.Office.Core

Regards
Scott Blood
C# Developer

"nagen" <na***@suriamsc.com> wrote in message
news:er***************@TK2MSFTNGP10.phx.gbl...
I have an existing excel file & i would like to enter a specific value at
cell A1 in Excel2003 using asp.net 2.0 how can i do this?


Mar 19 '06 #3
Has you added the excel reference to your uses clause?

Regards
Scott Blood
C# Developer
"nagen" <na***@suriamsc.com> wrote in message
news:uy**************@tk2msftngp13.phx.gbl...
i had added the assemblies but still unable to locate the Excel from using
keyword
how?

"scott blood" <sc*********@hotmail.com> wrote in message
news:ey**************@TK2MSFTNGP12.phx.gbl...
Hello,

You could try the following code.

Uses Excel;

Excel.Application excelApp = new Excel.ApplicationClass(); // create a
new Excel Application instance
excelApp.Visible = false; // set this property to true if you want the
excel window to popup
Excel.Workbook newWorkbook = excelApp.Workbooks.Open("test.xls", 0,
false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0,
true, false, false);
//replace test.xls with your own workbook path
Excel.Sheets excelSheets = newWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet );
Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("A1",
"A1");
excelCell.Value2 = "Timesheet for weekending " + cmbWeekEnd.Text + " (" +
cmbDepartment.Text + ")";
excelCell.Font.Size = 12;
excelCell.Font.Bold = true;

Dont forget to add a reference to the excel object library and
Microsoft.Office.Core

Regards
Scott Blood
C# Developer

"nagen" <na***@suriamsc.com> wrote in message
news:er***************@TK2MSFTNGP10.phx.gbl...
I have an existing excel file & i would like to enter a specific value at
cell A1 in Excel2003 using asp.net 2.0 how can i do this?



Mar 19 '06 #4

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

Similar topics

3
by: michael | last post by:
Hi, below is a snipplet that could be seen as a part of a spreadsheet with getter and setter properties and a way how to dynamically insert function to be used when setting the value of a "cell"...
2
by: Bertrand | last post by:
Hello, I am trying to archieve the following: - copy an excel file present on the server - insert values into named ranges of the copy I am using Excel97 on my PC, the server does not have...
2
by: Ceri | last post by:
I am running an ASP.Net project that runs 30 lengthy SQL Stored Procedures (each takes around 20 seconds to complete). As each Stored Procedure completes, I want to indicate in a table cell that it...
8
by: Stefan Mueller | last post by:
I'm really very confused. With the following code I can add rows/fields in frame 1 and 2. If I use IE, Mozilla or Opera the new rows/fields get added in ascending order. However, if I use Safari...
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
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
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
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.