Manipulating Excel

P

Paulo

using Excel;

Excel.Application ExcelApp = new Excel.ApplicationClass();
string workbookPath = Server.MapPath("excel\\produto1.xls");
Excel.Workbook excelWorkbook = ExcelApp.Workbooks.Open(workbookPath,
0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",
true, false, 0, true, false, false);
string currentSheet = "Plan1";
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item(currentSheet);


Im using the code above, but how can I loop through all the columns and rows
of the sheet? Can you help me?

Using VS 2005 asp.net 2.0 C#

Thanks!
 
M

Mark Rae [MVP]

Excel.Application ExcelApp = new Excel.ApplicationClass();
Im using the code above, but how can I loop through all the columns and
rows of the sheet?

You can't.

Excel, like the rest of Office, is not designed to run via server-side
Office automation - Microsoft won't support any solution which even attempts
this, because it doesn't work:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

To meet your requirements, you need this:
http://www.aspose.com/Products/Aspose.Cells/Default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top