Word.Documents.Save()和.SaveAs()都崩溃Word

编程入门 行业动态 更新时间:2024-10-27 16:29:02
本文介绍了Word.Documents.Save()和.SaveAs()都崩溃Word的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不确定这是否是正确的论坛,因为我没有使用VSTO,我正在使用PIA for Word与我的程序进行交互。 无论如何,该程序的目的是打开模板,插入用户先前输入的数据,插入表格和图片,并保存文档。除非我尝试保存文档,否则一切正常。它总是抛出这个COMException: $

I'm not sure if this is the correct forum to ask this because I'm not using VSTO, I'm using the PIA for Word to interface with my program.Anyway, the purpose of the program is to open up a template, insert data previously entered by users, insert a table and a picture, and save the document. Everything works fine except when I try to save the document. It always throws this COMException:

System.Runtime.InteropServices.COMException occurred ErrorCode=-2147417851 Message="The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))" Source="Microsoft.Office.Interop.Word" StackTrace: at Microsoft.Office.Interop.Word.DocumentClass.Save() at Project_Automation.Form1.cmdFinishDocument_Click(Object sender, EventArgs e) in ...Project Automation\Form1.vb:line 16201

推荐答案

你好詹姆斯, 你能和我们分享代码吗?如何创建新文档?通过使用Documents.Add()?据我所知,一般情况下,我们使用Documents.Add打开一个新文档,然后使用SaveAs / Save方法保存此文档。对于Documents.Add方法和SaveAs方法,请参阅这些MSDN页面: http:// msdn。 microsoft/en-us/library/bb237079.aspx 和 http:// msdn.microsoft/en-us/library/bb221597.aspx 。 实际上,这个论坛不是这个问题的最佳选择。对于Word Automation问题,最好的地方是 Invate On Office论坛或Word新闻组。对于这个单词新闻组,你会在这个论坛的请先阅读。 最好的问候, Bessie Hello James,Would you please share the code with us? How you create a new document? by using Documents.Add()? As far as I see, in general, we use Documents.Add to open a new document, and then use SaveAs/Savemethodto save this document. For Documents.Add method and SaveAs method, please refer to these MSDN pages:msdn.microsoft/en-us/library/bb237079.aspxand msdn.microsoft/en-us/library/bb221597.aspx.Actually, this forum is not the best place for this issue. For Word Automation issue, the best place would be Invate On Office forum or Word newsgroup. For this word newsgroup, you will find an appropriate entry link in this forum's PLEASE READ FIRST. Best regards,Bessie

更多推荐

Word.Documents.Save()和.SaveAs()都崩溃Word

本文发布于:2023-11-16 23:44:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1607999.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Documents   Word   SaveAs   Save

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!