在 Silverlight 3 中显示 Ms Word 2003 .doc

发布于 2024-11-02 14:01:21 字数 144 浏览 4 评论 0原文

我目前正在 Silverlight 中编写一个应用程序,该应用程序需要一个控件来显示 Word 2003 文档。我还可以在 Web 服务发送文档之前对其进行转换,但 2003 格式似乎很难操作。我知道有一些软件可以做到这一点,但你必须购买它们。你有什么线索可以帮助我进步吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

强者自强 2024-11-09 14:01:21

您想要达到什么保真度级别?

我非常确定,“最简单”的方法是将文档转换为 XPS 服务器端(可能使用 XPS 打印机),然后对其进行操作以创建 Silverlight 兼容内容(XAP)

为什么会这样?因为,例如:

  • Silverlight 不支持流文档,因此您不希望必须在客户端上执行布局。
  • Silverlight 要求字体包含在使用它的同一个 XAP 中(即使在同一个程序集中),因此您需要在服务器端生成一个嵌入字体的程序集。
  • XPS 是 zip 中的 XAML(因此比 Word2003 文档更容易管理),但它不是 Silverlight Xaml,您需要将其转换为 Silverlight,然后才能在 Silverlight 应用程序上读取它(使用 XSLT?注意,有将视口转换为缩放/平移变换所需的一些计算)。好消息是,任何布局问题都在 XPS 生成过程中得到解决。

一年前,我让一名实习生为 Silverlight 设计了 ​​XPS 阅读器的原型。它有效,但渲染并不完美(不过,我本来可以做更多的工作)

总而言之:这是可能的,并不复杂,但需要在一些领域(从 XSLT 到程序集生成,以及 XPS 规范的知识)。但我不知道有任何可用的免费解决方案。

因此,我建议使用可用(且有效)的解决方案,而不是采取冒险的开发路线。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文