1
我只是想知道如何将我的文档.doc路径转换为xps文件文档。DOC到XPS文件文档
如果任何人都可以帮助我很高兴知道VB.NET中的代码,因为我已经使用了它,但不幸的是我无法找到我的问题的最佳答案。
谢谢
我只是想知道如何将我的文档.doc路径转换为xps文件文档。DOC到XPS文件文档
如果任何人都可以帮助我很高兴知道VB.NET中的代码,因为我已经使用了它,但不幸的是我无法找到我的问题的最佳答案。
谢谢
我在控制台应用程序中使用了下面的代码。 您需要引用Microsoft.Office.Interop.Word程序集(稍后版本12才能生成XPS文件)并导入命名空间。
在VB中的代码是:
Option Explicit On
Module Module1
Sub Main()
Dim word As _Application
Dim doc As _Document
word = New Application
doc = word.Documents.Open("C:\test.doc")
doc.SaveAs("C:\test.xps", WdSaveFormat.wdFormatXPS)
word.Quit()
End Sub
End Module
而在C#:
using Microsoft.Office.Interop.Word;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
_Application word = new Application();
_Document doc = word.Documents.Open(@"C:\test.doc");
doc.SaveAs(@"C:\test.xps", WdSaveFormat.wdFormatXPS);
word.Quit();
}
}
}
优秀。工作很好,谢谢! – Alex 2013-05-27 14:03:15