C # How to enable and fix word
C # How can I open a corrupted word by using the following method:
ObjDocLast = objApp. Documents. Open (
Ref objOrgDoc, // file name
Ref objMissing, // confirm the version
Ref objMissing, // read-only
Ref objMissing, // Add to the nearest File
Ref objMissing, // Password File
Ref objMissing, // password detection Board
Ref objMissing, // reply
Ref objMissing, // write the password file
Ref objMissing, // enter the password
Ref objMissing, // format
Ref objMissing, // Encrypt
Ref objMissing, // visible
Ref objMissing, // open and fix
Ref objMissing, // Party A directly
Ref objMissing, // unencrypted dialog box
Ref objMissing // XML Transfer
);
# Region-open and fix the document-
Public static bool OpenAndRepair (string filePath, bool isVisible)
{
Try
{
OWord = new Microsoft. Office. Interop. Word. Application ();
OWord. Visible = isVisible;
Object path = filePath;
ODoc = oWord. Documents. Open (ref path,
Ref Nothing,
Ref Nothing,
Ref Nothing, true, ref Nothing );
Return true;
}
Catch (Exception)
{
Return false;
}
}
# Endregion
From love007