Q: Viewing an excel file

  • Thread starter Thread starter G .Net
  • Start date Start date
G

G .Net

Hi

Can anybody tell me how I can view an Excel file from within a vb.net
application?

Thanks in advance

G
 
What do you mean by view? Do you want to host/embed an excel
application or just read the data or something else?

Thanks,

Seth Rowe
 
The easiest way to display an excel file is to use a webbrowser control
and set the url to the target excel file. As far as readonly goes,
either tag the excel file as readonly or even use the protection
feature to "lock down" all the cells.

I'm curious, why not just use a datagrid instead of excel to display
the data?

Thanks,

Seth Rowe
 
Hi Seth

The excel file has graphics and formatting etc.

As far as the webbrowser control. Can you give me some example code?

Thanks in advance

G
 
No sample code needed really - you can do it through the designer.
First add the webbrowser control to your form - its under common
controls in the toolbox. Next, pull up the properties browser and set
the webbrowser's URL property to the excel files directory. That should
be it.

Thanks,

Seth Rowe
 
¤ Hi
¤
¤ Can anybody tell me how I can view an Excel file from within a vb.net
¤ application?

See if the following works for you:

How To Use the WebBrowser Control to Open an Office Document in Visual Basic .NET
http://support.microsoft.com/kb/304643


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Hi Paul

Thanks for the information.

I've tried it successully. However, I was wondering if you could help
further? When I open an excel file using Navigate, a dialog appears asking
if I want to save or open the file. Can this be avoided so that the file is
merely loaded into the component?

G
 
¤ Hi Paul
¤
¤ Thanks for the information.
¤
¤ I've tried it successully. However, I was wondering if you could help
¤ further? When I open an excel file using Navigate, a dialog appears asking
¤ if I want to save or open the file. Can this be avoided so that the file is
¤ merely loaded into the component?
¤
¤ G

It's the security mechanism that is implemented for displaying files in the IE browser which can be
potentially dangerous. Excel would be on the list since it can contain auto macro code.

When the Open/Save dialog pops, there is an option in the dialog which allows you to disable this
feature for the file type. If you un check it then the popup warning will no longer be displayed.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top