Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / August 2003

Tip: Looking for answers? Try searching our database.

Opening Excel workbook from ASP.NET Page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael - 31 Jul 2003 11:05 GMT
I have an Excel Object control on my ASP.NET page. How can
force a specific Excel workbook ( say "c:\myfile.xls") in
this object when my page opens.  Alternatively, how can I
open a specific exccel file in my ASP.NET Page.
Hanre Garbers - 01 Aug 2003 08:04 GMT
Hi

As I understand this your Excel object control expects a
path like 'c:\files\file1.xls' and not
like 'http://mysite/files/file1.xls' also not relative
like 'files/file1.xls'. If this is the case you can use
the Server.MapPath function. It takes the relative path
of the document as input and return the hard drive
location.

E.g. Server.MapPath("files/file1.xls") would return
something like 'c:\files\file1.xls', which your object
control could then use.

Place it in your Page_Load event e.g.:
me.xlsControl.load(Server.MapPath("files/file1.xls"))

or

me.xlsControl.Document = Server.MapPath("files/file1.xls")

Hope this helps!

Ta
>-----Original Message-----
>I have an Excel Object control on my ASP.NET page. How can
>force a specific Excel workbook ( say "c:\myfile.xls") in
>this object when my page opens.  Alternatively, how can I
>open a specific exccel file in my ASP.NET Page.
>.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.