Display a Ms Word 2003 .doc in Silverlight 3
I'm currently programming an application in Silverlight which need to have a control开发者_开发技巧 to display a Word 2003 document . I can also convert the document before the webservice sends it but the 2003 format seems to be quite harsh to manipulate. I know there's some softwares which can do it but you have to purchase them. Do you have any clue to help me to progress ?
What is the level of fidelity you want to achieve?
I am quite sure that the "easiest" way of doing this would be to convert the document to XPS serverside (with the XPS printer perhaps) then manipulating it to create a Silverlight compatible content (a XAP)
Why this? Because, for instance:
- Silverlight does not support flow documents, therefore you don't want to have to perform the layout on the client.
- Silverlight requires fonts to be included in the same XAP that is using it (even in the same assembly), therefore you need to generate an assembly with the font embedded in it serverside.
- XPS is XAML in a zip (therefore a lot better to manage than Word2003 doc), but it isn't Silverlight Xaml, you need to convert it to Silverlight before being able to read it on your Silverlight App (using XSLT? beware, there are some calculations required to convert viewports into scale/translate transforms). The good news is that any layout problems were taken care of in the XPS generation process.
I had an intern design a prototype of XPS reader for Silverlight a year ago. It worked, but the rendering wasn't perfect (I could have been however, with more work)
In a word: It's possible, not really complicated, but requires lot of work and practice in a few domains (from XSLT to assembly generation, and knowledge of the XPS norms). But I am not aware of any free solutions available.
Therefore, I would recommand using an available (and working) solution, rather than taking the route of a risky development.
精彩评论