普通文档没有问题,如果是带密码的文档就打不开了
也不抛错。
谁能告诉怎样才能打开,或者抛错也可以!!!
也不抛错。
谁能告诉怎样才能打开,或者抛错也可以!!!
解决方案 »
- 函数调用的问题
- form = null 及 form.dispose()
- 找不到类型或命名空间名称“Excel”的问题,急,在线等
- 64位机器下c#调用waveOutOpen时错误
- 一点击某按钮后,FileUpload对话框中的内容就消失了,不让它消失该怎么办啊?
- 关于Visual Studio中的“引用”.NET类和COM组件的问题
- Num Cap Insert
- 请教一个Client端接收Service端信息的问题
- 急!!!为什么遍历不到动态添加的控件?
- 在winform里怎么把查到的abc分别赋值给ABC
- 请教,C#如何在office2000的access数据库表中,存图片(.jpg/.gif格式),不是存地址,而是存入二进制值的方法(代码)
- SQL output 的问题,在C# codes中无法正确捕捉返回值
{
string FileName = "e:\\test.doc"; if(FileName == "") return; try
{
Word.ApplicationClass thisApplication =
new Word.ApplicationClass();
thisApplication.Visible = true;
thisApplication.Caption = "";
thisApplication.Options.CheckSpellingAsYouType = false;
thisApplication.Options.CheckGrammarAsYouType = false; Object filename = FileName;
Object ConfirmConversions = false;
Object ReadOnly = false;
Object AddToRecentFiles = false; Object PasswordDocument = System.Type.Missing;
Object PasswordTemplate = System.Type.Missing;
Object Revert = System.Type.Missing;
Object WritePasswordDocument = System.Type.Missing;
Object WritePasswordTemplate = System.Type.Missing;
Object Format = System.Type.Missing;
Object Encoding = System.Type.Missing;
Object Visible = System.Type.Missing;
Object OpenAndRepair = System.Type.Missing;
Object DocumentDirection = System.Type.Missing;
Object NoEncodingDialog = System.Type.Missing;
Object XMLTransform = System.Type.Missing; // Microsoft.Office.Interop.Word.DocumentClass wordDoc =
// wordApp.Documents.Open(ref filename, ref ConfirmConversions,
// ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate,
// ref Revert,ref WritePasswordDocument, ref WritePasswordTemplate, ref Format,
// ref Encoding, ref Visible);
// Microsoft.Office.Interop.Word.DocumentClass wordDoc =
// wordApp.Documents.Open(ref filename, ref ConfirmConversions,
// ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate,
// ref Revert,ref WritePasswordDocument, ref WritePasswordTemplate, ref Format,
// ref Encoding, ref Visible, ref OpenAndRepair, ref DocumentDirection, ref NoEncodingDialog); Word.Document wordDoc =
thisApplication.Documents.Open(ref filename, ref ConfirmConversions,
ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate,
ref Revert,ref WritePasswordDocument, ref WritePasswordTemplate, ref Format,
ref Encoding, ref Visible, ref OpenAndRepair, ref DocumentDirection,
ref NoEncodingDialog, ref XMLTransform ); Word.Document thisDocument = wordDoc; Word.FormFields formFields = wordDoc.FormFields;
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString()); }
}