Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
How to open the word document as MdI child to mdi Parent form in C#
Posted 19-Nov-12 5:11am
Comments
Sergey Alexandrovich Kryukov at 19-Nov-12 12:04pm
   
Tag: "Forms".
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is no a public component ready-to-use component to render Word document I'm aware of. This is very unlikely, because Word is a proprietary application. In general, I think that the numerous questions about Word reflect non-developer's approach to the problem, but the approach of plain computer uses still not understanding well who is who. It would be much better to use documents of other types, such as Microsoft Flow Document, HTML or the like.
 
There are some written in C++, a part of LibreOffice/OpenOffice. If you only need to render the document on screen, in principle you can use C++ code through P/Invoke. Or you can implement .NET components from scratch, but it will be a huge work. However, this is quite possible if you want to use newer Microsoft Office XML-bases format, because it is standardized under ECMA-376:
http://en.wikipedia.org/wiki/Office_Open_XML[^],
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://www.ecma-international.org/publications/standards/Ecma-376.htm[^].
 
Alternatively, instead of fully-fledged implementation, you can parse Office document, map it so some other document structure, without one-to-one correspondence, and render it. This approach is typical on some Web sites, with Office<—>HTML mapping — for example, look at career sites. (And for Forms, CodeProject has a wonderful "secret weapon"! — see this article: A Professional HTML Renderer You Will Use[^].)
 
See also my past answers:
Convert Office-Documents to PDF without interop[^],
Hi how can i display word file in windows application using c#.net[^].
 
And finally, let me note on MDI. Here is the idea: who needs MDI, ever? Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^].
 
I can explain what to do instead. Please see my past answers:
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].
 
—SA
  Permalink  
v5
Comments
Abhishek Pant at 19-Nov-12 12:38pm
   
my 5! Excellent advice-Got important links from above,thanks Sergey
Sergey Alexandrovich Kryukov at 19-Nov-12 14:12pm
   
Great, thank you, Abhishek.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

It is really unlikely to have such a word component as Sergey said above. But as open and read task, you can find a word viewer. It is much easier to use word viewer[^] to open the word files in multiple forms. Here I can suggest you one Spire.DocViewer which is a commercial one and built from c#. Anyhow, not very dear.
  Permalink  

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

  Print Answers RSS
0 Maciej Los 225
1 Sergey Alexandrovich Kryukov 167
2 _Amy 155
3 CHill60 130
4 Manfred R. Bihy 130
0 OriginalGriff 7,320
1 Sergey Alexandrovich Kryukov 6,043
2 Maciej Los 3,754
3 Peter Leow 3,448
4 CHill60 2,572


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 19 Nov 2012
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