C # How to enable and fix word

Source: Internet
Author: User

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
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.