Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to give option to read word file in a website.
which language should i choose for that?
Please give me some example.

Thanks in advance
Posted

1 solution

C# is quite fine; you can post a file in the browser and read it on the server side. You can use Office interop: add a reference to your project using the COM tab; the assembly name will be like "Microsoft Word *.* Object Library".

There are many code samples around, like this one: http://zirmandli.wordpress.com/2007/07/04/read-word-doc-using-c/[^].

You will able to find some more if you Google.

Original documentation:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word%28v=office.14%29.aspx[^],
http://msdn.microsoft.com/en-us/library/ff597928.aspx[^],
http://msdn.microsoft.com/en-us/library/ff601860.aspx[^].

As to JavaScript — its theoretically possible, but I doubt it even make sense. However, you can find some projects like
http://www.kavoir.com/2009/01/using-javascript-to-open-excel-and-word-files-in-html.html[^]; try to find some more, but I would not recommend it.

Also, I hope you realize that you cannot present a Word document on a Web page as is. This is proprietary format, not standardized with W3, so it does not really belongs on the Web. In real life though, there are a number of applications working with Word documents and even provide some editing capabilities (one typical example: job search sites). But in this case, everything is done in the form of HTML or XML; word documents are converted into HTML for presentation and editing and saved as Word by converting from HTML or XML.

—SA
 
Share this answer
 
v2
Comments
sahabiswarup 25-Jan-12 0:40am    
thanks
5 from me
Sergey Alexandrovich Kryukov 25-Jan-12 1:21am    
You are welcome.
If so, please accept the answer formally (green button) -- thanks.
--SA
sahabiswarup 25-Jan-12 0:40am    
i have tried that javascript
its not working.
Sergey Alexandrovich Kryukov 25-Jan-12 1:22am    
No wonder, thanks for reporting this issue. I told you that I doubt it makes sense. I just said that you can find some like that.

However, .NET binding always works on Word, that's for sure.
--SA
Rajesh Anuhya 25-Jan-12 1:12am    
Good links , have my+5

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