473,385 Members | 1,154 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,385 software developers and data experts.

Updating Excel Sheet

Hi all
i am having application storing data in excel sheet.
This applicaton is in C# .net.
I want to update rows of excel sheet in C#.
Can some one help me how to do it.
please help me.
Thanks in advance.

Nov 17 '05 #1
1 4351
GG
These are some helpful methods that may help you
private void setCellValue(ref Excel._Worksheet objSheet, int rowIndex,
int columnIndex,string cellValue)
{
Excel.Range objCells = objSheet.Cells;
Excel.Range objCell = (Excel.Range)objCells[rowIndex,columnIndex];
objCell.Value2 = cellValue;
releaseComObj(objCell);
releaseComObj(objCells);
}
private void setCellFontSize(ref Excel._Worksheet objSheet, int
rowIndex, int columnIndex,int fontSize)
{
Excel.Range objCells = objSheet.Cells;
Excel.Range objCell = (Excel.Range)objCells[rowIndex,columnIndex];
Excel.Font objFont = objCell.Font;
objFont.Size = fontSize;
releaseComObj(objFont);
releaseComObj(objCell);
releaseComObj(objCells);
}
private void setCellFontBold(ref Excel._Worksheet objSheet, int
rowIndex, int columnIndex,bool boldFont)
{
Excel.Range objCells = objSheet.Cells;
Excel.Range objCell = (Excel.Range)objCells[rowIndex,columnIndex];
Excel.Font objFont = objCell.Font;
objFont.Bold = true;
releaseComObj(objFont);
releaseComObj(objCell);
releaseComObj(objCells);
}
private void releaseComObj(object o)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComO bject(o);
}
catch {}
finally
{
o = null;
}
}
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #2

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...
12
by: elziko | last post by:
I'm using late binding (I must) to automate Excel. My code opens Excel after createing and poulating some sheets. My problem is that when the user finally decides to close Excel its process is...
3
by: | last post by:
Hello, I have a routine in my Windows application that exports the contents of a datagrid to Excel. It is modeled closely after the HowTo example on MSDN: http://tinyurl.com/5g2jm. Depending...
3
by: | last post by:
I wrote a class in VB.NET to export the contents of a datagrid to Excel. It works perfectly on my machine, but it fails on my customers' PCs that have identical versions of Win XP (SP1) and Excel...
3
by: implicate_order | last post by:
Greetings, I'm new to python and am in the process of writing a script to parse some CSV data, spread it across multiple Excel worksheets and then generate charts. I searched the internet to...
3
by: pleaseexplaintome_2 | last post by:
using the code below (some parts not included), I create a new excel workbook with spreadheets. I then want to delete a spreadsheet, but a reference remains open and excel stays in task manager...
13
by: chuckie_9497 | last post by:
hello all you gurus. I am struggling with releasing com objects. I have isolated the problem to the code below. Objects are released and the process ends until I use "int k = sheet.Count;" Then...
9
by: LucasLondon | last post by:
Hi, Sorry, this is a bit of a lengthy one but I guess too much information is better than less! I have an excel worksheet that I update regulary with latest values from downloaded CSV files....
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.