- private void WriteWordDocument(object filePath)
- {
- object missing = System.Reflection.Missing.Value;
- ApplicationClass wordApp = null;
- _Document doc = null;
- try
- {
- wordApp = new ApplicationClass();
- wordApp.Visible = true;
- //open word
- doc = wordApp.Documents.Open(ref filePath,
C#修改Word文档内容
最新推荐文章于 2024-06-23 22:22:40 发布
这段代码演示了如何使用C#的ApplicationClass打开并修改Word文档内容,将文本替换为'This is write word test!',然后保存更改。程序中包含了异常处理和资源清理。
摘要由CSDN通过智能技术生成