我有一个存储为 .bin 文件的 Word 8.0 文档,我正在尝试使用 C# 和 Microsoft.Office.Interop 在 MS Word 中重新打开该文档。我可以让文档打开并显示内容,但是它不应用文档的任何样式(例如字体大小、下划线等)
我的代码如下:
object pathToBin = @"\\server\folder\123.bin";
object missingType = Type.Missing;
object readOnly = true;
object isVisible = false;
object documentFormat = WdOpenFormat.wdOpenFormatDocument97;
Application applicationclass = new Application();
applicationclass.Documents.Open(ref pathToBin,
ref readOnly,
ref missingType, ref missingType, ref missingType,
ref missingType, ref missingType, ref missingType,
ref missingType, ref missingType, ref isVisible,
ref missingType, ref missingType, ref missingType,
ref missingType, ref missingType);
applicationclass.Visible = true;
Document document = applicationclass.ActiveDocument;
当文档本身打开时,它似乎在字面上显示如下样式:
Heading 1
Heading 1
Heading 2
Heading 2
Heading 3
Heading 3
Hyperlink
Hyperlink
等等
有什么想法吗?