Document.SaveAs方法没有密码?
我想另存为没有密码的文档。 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据此链接,
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 justMissing.Value
in disguise, so if the latter is not working, neither will the former.