Hi My earlier question about "Read from a Excel file" is invalid  , just ignore.

here is the actuall question ,
I want to read from .xls file not from .csv file . 
that also by using of "Interop.Office.dll" (a com object)
have a look at the following code ....
please reply with your valuable comments.

Regards 
AC

private void ReadfromCSV(string filename)
  {
   try
   {
    Excel.Application objExcel=new Excel.Application();
    Excel.Workbook objWorkbook = objExcel.Workbooks.Open(filename, 0, true, 
5,"", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true);

    Excel.Sheets sheets =  objWorkbook.Worksheets;

    Excel.Worksheet objWorksheet = (Excel.Worksheet)sheets.get_Item(1);

    for (int i = 1; i <= 10; i++)
    {
     Excel.Range range = objWorksheet.get_Range("A"+i.ToString(), "J" + 
i.ToString());
     System.Array myvalues = (System.Array)range.Cells.Value;
     string[] strArray = ConvertToStringArray(myvalues);
     //listView1.Items.Add(new ListViewItem(strArray));
    }


   }
   catch (Exception ex)
   {
    lab_ErrMsg.Text=ex.ToString(); 
   }

  }



Arindam Chakraborty
Software Developer,
Mumbai,
 India




                
---------------------------------
 Yahoo! India Matrimony: Find your partner now.

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to