Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Manipulating Excel

Reply
Thread Tools

Manipulating Excel

 
 
Paulo
Guest
Posts: n/a
 
      09-28-2007
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!


 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-28-2007
"Paulo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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...US;q257757#kb2

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


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
 
sloan
Guest
Posts: n/a
 
      09-28-2007



You can use a System.Data.OleDb.OleDbConnection and get an IDataReader
against the Excel spreadsheet.
http://support.microsoft.com/kb/316934


It would be best to avoid the excel object model, and as pointed out
already, is a really bad idea server side.






"Paulo" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
Manipulating excel spreadsheets in C++ spirit C++ 4 08-03-2007 07:53 PM
Manipulating Excel data with ASP.NET =?Utf-8?B?Smlt?= ASP .Net 6 11-03-2005 07:01 PM
Manipulating with the T1, T0 and TX in a SAIF file. Kelvin Tsai @ Singapore VHDL 0 09-09-2003 01:46 AM
Manipulating a User Control from another User Control Tom Rowton ASP .Net 2 08-01-2003 08:18 PM



Advertisments