【问题标题】:Convert ms word document to svg in C# or C++在 C# 或 C++ 中将 ms word 文档转换为 svg
【发布时间】:2013-05-24 02:37:51
【问题描述】:

我想在网络浏览器中查看 MS Word 文档。所以我需要将其转换为 svg 格式。 如何使用 c# 或 c++ 语言将 MS Word 文档转换为 SVG 格式?哪个开源库可以支持?

【问题讨论】:

    标签: c# c++ visual-c++ svg ms-word


    【解决方案1】:

    有一个库 DocX 可能会有所帮助。 http://docx.codeplex.com/ 然后你可以阅读 docx 文件并编写你自己的转换器。

    或者您可以使用 Microsoft 的 Office 互操作库并将 docx 转换为 .pdf 或 .html 等格式。稍后将其转换为 .svg 会更容易。 代码在http://cathalscorner.blogspot.jp/2009/10/converting-docx-into-doc-pdf-html.html

    【讨论】:

      【解决方案2】:

      我使用 Print2Flash 库直接从我的 ASP.NET 网站的 Word 文档中使用 c# 获取 SVG 文件。我相信它也支持 C++。您需要:

      1. 在您的服务器上下载并安装 Print2Flash
      2. 下载 Print2Flash SDK 并从中提取 ASP.NET 和 C++ 示例

      那么您只需要按照示例使用说明进行操作即可。这两个文件都可以从这个下载页面获得:http://print2flash.com/download.php

      【讨论】:

        【解决方案3】:

        Aspose 为 C#C++ 提供了一个库,用于将 Word 文档转换为 SVG。

        • 在 C# 中执行转换的代码片段

          // The path to the documents directory.
          string dataDir = RunExamples.GetDataDir_QuickStart();
          
          // Load the document from disk.
          Document doc = new Document(dataDir + "Document.doc");
          
          dataDir = dataDir + "ConvertDocumentToSVG.svg";
          
          // Save the document in SVG format.
          doc.Save(dataDir);
          
        • 在 C++ 中执行转换的代码片段

          // The path to the documents directories.
          System::String inputDataDir = GetInputDataDir_LoadingAndSaving();
          System::String outputDataDir = GetOutputDataDir_LoadingAndSaving();
          
          // Load the document from disk.
          System::SharedPtr<Document> doc = System::MakeObject<Document>(inputDataDir + u"Document.doc");
          System::String outputPath = outputDataDir + u"ConvertDocumentToSVG.svg";
          
          // Save the document as SVG.");
          doc->Save(outputPath);
          

        详情请查看文档:

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-11-30
          • 1970-01-01
          • 2010-09-14
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多