Document.SaveAs method withoud password?
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);
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.
精彩评论