How to use WebBrowser (vb) to show various kinds of file?


B

Benson

I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since those
kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>> show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==> seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==> Is it right to use this method??

Thanks advance.
Benson.
 
Ad

Advertisements

R

RobinS

I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you tried
that?

Robin S.
 
B

Benson

Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for viewing
such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.
 
R

RobinS

I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
 
B

Benson

Thank you very much.
Benson

RobinS said:
I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

Good luck; let me know how it goes.
Robin S.
 
Ad

Advertisements

M

msdnuniv

I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

yes, and normally it's easier just to call the file, which opens the
assiciated program automatically (could be openOffice?)
But anyway:
If you want to show anything in the browser, it must know the mime-type to
be able to correctly do this and load the correct plugin.

Greetings,
Dirk
 
R

RobinS

Yes, you're right! Good one!

Robin S.
--------------------------
Bruce W. Darby said:
Robin,

Doesn't Wordpad allow one to open a .doc?

Bruce

RobinS said:
I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
Benson said:
Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for
viewing such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <[email protected]>
׫O'ì¶à]¼þÐÂÂ":[email protected]
I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you
tried that?

Robin S.
------------------------------------------
I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since
those kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>> show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==> seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==> Is it right to use this method??

Thanks advance.
Benson.
 
A

aaron.kempf

webbrowser control works great.. i use those in Access forms _ALL_ the
time.
Insert, ActiveX control.

you see; Robin doesn't understand when / where people use the Office
Web Components.

the main reason I say 'screw DOTNET' is because they don't have
anything as powerful as OWC

I mean.. VS 2002 and 2003 didn't even support the WebBrowser control..
right?

That's LAUGHABLE. There was a simple wizard for using it in VB6.
it always makes me laugh when I find things that are really really
really easy to do inside of VB6 or Access.. and this new DOTNET _CRAP_
can't do it

it's like.. what kind of ****ing idiot would try to sell us on a
platform that was _LESS_POWERFUL_?

I mean seriously here; do these people know how to read plain
english??

-Aaron
 
B

Bruce W. Darby

Thanks Robin.... ya know... sometimes I just can't STAND it when I have a
flash of brilliance... ROFL

RobinS said:
Yes, you're right! Good one!

Robin S.
--------------------------
Bruce W. Darby said:
Robin,

Doesn't Wordpad allow one to open a .doc?

Bruce

RobinS said:
I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for
viewing such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <[email protected]>
׫O'ì¶à]¼þÐÂÂ":[email protected]
I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you
tried that?

Robin S.
------------------------------------------
I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since
those kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>> show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==> seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==> Is it right to use this method??

Thanks advance.
Benson.
 
B

Bruce W. Darby

Dirk,

Thanks for the heads-up. :)

Bruce

msdnuniv said:
yes, and normally it's easier just to call the file, which opens the
assiciated program automatically (could be openOffice?)
But anyway:
If you want to show anything in the browser, it must know the mime-type to
be able to correctly do this and load the correct plugin.

Greetings,
Dirk
 
Ad

Advertisements

C

C-Services Holland b.v.

RobinS schreef:
Yes, you're right! Good one!

Robin S.


That's only if you're not using some fancy stuff. And does wordpad open
docs from the latest incarnations of office?

Rinze
 
Ad

Advertisements

R

RobinS

C-Services Holland b.v. said:
RobinS schreef:


That's only if you're not using some fancy stuff. And does wordpad open
docs from the latest incarnations of office?

Rinze

If you're talking about Office2007, then probably not, but if they are in
the new xml format, you can open them in the Browser. Or so they said today
at the Microsoft Vista Launch that I attended.

Robin S.
 

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

Top