Click here to Skip to main content
13,045,657 members (65,721 online)
Rate this:
Please Sign up or sign in to vote.
how can i show a ms word file in webKitBrowser after clicking on http:\\link.doc ?
Posted 10-May-13 6:22am
Updated 10-May-13 13:27pm
Sergey Alexandrovich Kryukov 10-May-13 12:32pm
Do you have any code to show a Word document anywhere at all?
Naourass Derouichi 10-May-13 12:38pm
here is my code:
webBrowser1.Navigate("" + currentNav);

i can use regex to fetch the current navigation link if its finishing by .doc or .docx, but i think it s useless to fetch all time all the navigated links...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please see my comment to the question. You could be better off by presenting a word document in the form of HTML, as all you need is showing the document. This way, you would not be tied up by the WebKit only and could use this solution anywhere, and, importantly, even on the server side of an HTTP server.

Please see my past answers:
Hi how can i display word file in windows application using[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^],
Microsot office Interop[^],
How to add microsoft excel 15.0 object library from Add Reference in MS Visual Studio 2010[^].

Naourass Derouichi 10-May-13 12:44pm
how can i show it in the form of HTML please?
Sergey Alexandrovich Kryukov 10-May-13 12:52pm
Did I try to explain it in my referenced answers? I cannot show you the whole code, it would take too much time and space. The idea is: there is no one-to-one correspondence between Word and HTML documents, so you would need to devise some mapping between those document which at least make the view similar. I explained you how can you achieve parsing of *.docx (I would recommend Open XML SDK, but you can try out different options), and I hope you know HTML (as soon as you are using WebKit, etc.). And I hope you can define mapping between the two and can use it to produce output HTML. This is just the work, and not a short one. As I can see, there are many sites operating Word documents this way, and they often even provide an editing tool, which is much more difficult...

Are you getting the idea now?
Naourass Derouichi 10-May-13 13:01pm
ok i will try to do this with pleasure! just tell me the first step, as i mentionned in my first comment, is to parse every clicked link and check if it's an (http:******.doc) link? is there a way to avoid parsing every clicked link of the browser? thank you for the help!
Sergey Alexandrovich Kryukov 10-May-13 13:21pm
Great. As to the click on *.DOC, this is a more difficult issue. You would write "doc" but in fact substitute an HTML document instead. How to do it? I doubt you should, but it depends on your scenario which I don't know. What people usually do is: in a Web application, they accept doc/docx uploads, and then store it in a database, but convert it as HTML on the fly when showing it is required. The "click" you mention is done not on any document, but on, say, ASP.NET script stored on the server side; the script does all requred conversion, or whatever. Perhaps if you describe the goal of your project, you can get some further advice...
Naourass Derouichi 10-May-13 13:36pm
thank you for the informations.
Sergey Alexandrovich Kryukov 10-May-13 13:50pm
My pleasure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 11 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100