How to set cell property in EXCEL using C#.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • romcab
    New Member
    • Sep 2007
    • 108

    How to set cell property in EXCEL using C#.net

    Hi guys,

    I would like to ask if it's possible to set a EXCEL cell property using C#.net. For example, I would like a certain cell format to DATE. Currently, my program can only set value and cell color, set wraptext. Below is my code snippet and hope you can give me idea.

    //add data on a particular row
    private void AddGetData(stri ng[] str, int sheet)
    {
    Excel.Sheets sh = m_wb.Sheets;
    Excel.Worksheet ws = (Excel.Workshee t)sh[sheet];
    string arow = m_row.ToString( );
    string _row = "A" + arow + ":" + "M" + arow;
    Excel.Range acell = ws.get_Range(_r ow, Type.Missing);
    acell.Value2 = str;
    //change the cell color in sheet1
    _row = "A" + arow + ":" + "A" + arow;
    ws.get_Range(_r ow, Type.Missing).I nterior.ColorIn dex = 38;
    acell.
    }
  • romcab
    New Member
    • Sep 2007
    • 108

    #2
    Hello guys,

    I was able to set some property, the only problem i have right now is to convert text to mm/dd/yyyy (Date) format. when I set the format using cell.Numberform at = Date, it doesnt work. Hope you can help me guys...

    Comment

    Working...