Document.SaveAs方法没有密码?

发布于 2024-09-13 20:38:29 字数 1265 浏览 5 评论 0原文

我想另存为没有密码的文档。 4. SaveAs方法和6.参数 密码-->用于打开文档的密码字符串。 (参见下面的备注。) 写入密码 -->用于保存对文档所做更改的密码字符串。 (参见下面的备注。) 如果我使用对象缺失 = string.Empty 和对象缺失 = System.Reflection.Missing.Value 行,则保存的文档已损坏并且无法打开。如何保存为没有密码的文档。请帮忙

object FileName = RIS_CLIENT.Properties.Settings.Default.DownloadPath + "\\" + m_docFileName + ".docm";
                object FileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocumentMacroEnabled;
                object LockComments = false;
                object AddToRecentFiles = false;
                object ReadOnlyRecommended = false;
                object EmbedTrueTypeFonts = false;
                object SaveNativePictureFormat = true;
                object SaveFormsData = false;
                object SaveAsAOCELetter = false;
                object missing = "pass";
              //object missing = String.Empty;
              //object missing = System.Reflection.Missing.Value;  


                objWinWordControl.document.SaveAs(ref FileName, ref FileFormat, ref LockComments, ref missing,
                    ref AddToRecentFiles, ref missing, ref ReadOnlyRecommended, ref EmbedTrueTypeFonts,
                    ref SaveNativePictureFormat, ref SaveFormsData, ref SaveAsAOCELetter);

I want to save as a document without a password. The method SaveAs 4. and 6. parameters
Password --> A password string for opening the document. (See Remarks below.)
WritePassword --> A password string for saving changes to the document. (See Remarks below.)
If I use the object missing = string.Empty and object missing = System.Reflection.Missing.Value lines the document saved corrupted and it can not be opened. What to do to save as the document without password. Please help

object FileName = RIS_CLIENT.Properties.Settings.Default.DownloadPath + "\\" + m_docFileName + ".docm";
                object FileFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXMLDocumentMacroEnabled;
                object LockComments = false;
                object AddToRecentFiles = false;
                object ReadOnlyRecommended = false;
                object EmbedTrueTypeFonts = false;
                object SaveNativePictureFormat = true;
                object SaveFormsData = false;
                object SaveAsAOCELetter = false;
                object missing = "pass";
              //object missing = String.Empty;
              //object missing = System.Reflection.Missing.Value;  


                objWinWordControl.document.SaveAs(ref FileName, ref FileFormat, ref LockComments, ref missing,
                    ref AddToRecentFiles, ref missing, ref ReadOnlyRecommended, ref EmbedTrueTypeFonts,
                    ref SaveNativePictureFormat, ref SaveFormsData, ref SaveAsAOCELetter);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

庆幸我还是我 2024-09-20 20:38:29

根据此链接System.Reflection。 Missing.Value 是指定缺失值的正确方法,但你说这不起作用。

我还发现另一个链接正在使用System.Type.Missing,因此您可能希望尝试这种方法。

编辑:实际上,Type.Missing实际上只是变相的Missing.Value,所以如果后者不起作用,那么前者也不起作用。

According to this link, System.Reflection.Missing.Value is the correct way of specifying missing values, but you say that does not work.

I also found another link which is using System.Type.Missing, so you may wish to try this approach.

Edit: actually, it appears that Type.Missing is actually just Missing.Value in disguise, so if the latter is not working, neither will the former.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文