Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Updating Excel Sheet

0 views
Skip to first unread message

trialpro...@yahoo.com

unread,
Sep 30, 2005, 6:47:31 AM9/30/05
to
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.

GG

unread,
Sep 30, 2005, 3:48:35 PM9/30/05
to
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.ReleaseComObject(o);
}
catch {}
finally
{
o = null;
}
}


*** Sent via Developersdex http://www.developersdex.com ***

0 new messages