Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 27th, 2005, 03:35 AM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excel to HTML


My asp.net application needs to read an excel file
(created at runtime) and display it as html table
on the webpage. The background/ foreground colors
in excel needs to be retained in the table.

I tried reading a few rows. But it just displays
System.__ComObject instead of displaying the values.

 excelobj.Workbooks.Open("c:/abc.xls")
 excelwksheet = excelobj.Workbooks(1).Worksheets("Sheet1")

 For iRowCtr = 1 To 5
    For iColCtr = 1 To 5
        Response.Write(excelwksheet.Cells(iRowCtr, iColCtr))
    Next
 Next

How do i get rid of this problem? Anyone who can help me out?
PLease help!


:) Cheers..
Spacy...
 
Old January 28th, 2005, 02:08 PM
Authorized User
 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

You are getting "System.__ComObject" because you are trying to print an Excel Cell object rather than it's value. Basically Cell is also a com component, so when you are sending Cell object as a parameter to Response.Write() then it is showing it's type.
If you want to print the value of a perticular cell then just modify your code like :

For iRowCtr = 1 To 5
    For iColCtr = 1 To 5
        Response.Write(excelwksheet.Cells(iRowCtr, iColCtr).Value)
    Next
 Next

NOTE : you may not get "Value" in the list but try to work use it, it really works.




Hope It Helps !!
Bhaskar Ghosh
 
Old January 31st, 2005, 12:26 AM
Authorized User
 
Join Date: Jul 2004
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Thanks buddy! That helped a lot!!!

:)Cheers..
Spacy...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Export HTML to Excel dbellavi C# 2005 3 December 19th, 2007 08:48 AM
Excel ALT+ENTER, Html equivalent? lizard8890 Excel VBA 1 October 16th, 2006 03:53 AM
Open Excel Sheet in HTML pankajm HTML Code Clinic 1 January 3rd, 2006 04:18 PM
Export HTML graph to Excel Jorge Classic ASP Basics 8 February 10th, 2005 01:54 PM
Html to Excel problem spacy ASP.NET 1.x and 2.0 Application Design 1 October 23rd, 2004 05:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.