Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
how can i show a ms word file in webKitBrowser after clicking on http:\\link.doc ?
Posted
Updated 10-May-13 13:27pm
v2
Comments
Sergey Alexandrovich Kryukov 10-May-13 12:32pm    
Do you have any code to show a Word document anywhere at all?
—SA
Nnorss 10-May-13 12:38pm    
here is my code:
webBrowser1.Navigate("docs.google.com/viewer?url=" + 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

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 c#.net[^],
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[^].

—SA
 
Share this answer
 
Comments
Nnorss 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?
—SA
Nnorss 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...
—SA
Nnorss 10-May-13 13:36pm    
thank you for the informations.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900