有没有人知道任何一个组件或库(最好是开源的),可以让我在ASP.NET中将Word 2007文档转换为Word 2003?
要使用Visual Studio Tools for Office (VSTO),您需要在服务器上安装Office 2007。
Microsoft.Office.Tools.Word.Document.SaveAs
public virtual void SaveAs (
[OptionalAttribute] ref Object FileName,
[OptionalAttribute] ref Object FileFormat,
[OptionalAttribute] ref Object LockComments,
[OptionalAttribute] ref Object Password,
[OptionalAttribute] ref Object AddToRecentFiles,
[OptionalAttribute] ref Object WritePassword,
[OptionalAttribute] ref Object ReadOnlyRecommended,
[OptionalAttribute] ref Object EmbedTrueTypeFonts,
[OptionalAttribute] ref Object SaveNativePictureFormat,
[OptionalAttribute] ref Object SaveFormsData,
[OptionalAttribute] ref Object SaveAsAOCELetter,
[OptionalAttribute] ref Object Encoding,
[OptionalAttribute] ref Object InsertLineBreaks,
[OptionalAttribute] ref Object AllowSubstitutions,
[OptionalAttribute] ref Object LineEnding,
[OptionalAttribute] ref Object AddBiDiMarks
)
您需要从WdSaveFormat枚举中指定自定义FileFormat
。
我没有找到如何强制使用旧的2003格式,但您可以将其保存为RTF格式(WdSaveFormat.wdFormatRTF
)。
你能否安装(或让你的用户安装)Microsoft Office 兼容性包?这样,Word 2003 就可以打开 Word 2007 保存的二进制 (.doc) 和 XML (.docx) 格式的文档。
如果你的公司有大量的 2007 文档需要处理,那么你可以编写一个 Word 2003 插件,使用 FileSystemWatcher
监视文件夹中的文件。然后将其以 2003 格式打开并重新保存到新位置。
作为一次跟进,我已经获得了使用Aspose.Words for .NET的许可。感谢您对这个问题的评论和建议。谢谢!