Click here to Skip to main content
Rate this: bad
good
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 7:22am
Nnorss521
Edited 10-May-13 14:27pm
v2
Comments
Sergey Alexandrovich Kryukov at 10-May-13 12:32pm
   
Do you have any code to show a Word document anywhere at all?
—SA
Naourass Derouichi at 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

Rate this: bad
good
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 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
  Permalink  
Comments
Naourass Derouichi at 10-May-13 12:44pm
   
how can i show it in the form of HTML please?
Sergey Alexandrovich Kryukov at 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
Naourass Derouichi at 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 at 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
Naourass Derouichi at 10-May-13 13:36pm
   
thank you for the informations.
Sergey Alexandrovich Kryukov at 10-May-13 13:50pm
   
My pleasure.
—SA

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

  Print Answers RSS
0 OriginalGriff 250
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 DamithSL 125
4 Afzaal Ahmad Zeeshan 120
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 11 May 2013
Copyright © CodeProject, 1999-2014
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