WORD 文件打开的问题
private Word.ApplicationClass oldWordApplic;
private Word.Document oDoc;
private static readonly string modWord = ConfigurationManager.AppSettings[ "WordMod "];//模板路径
private static readonly string docWord = ConfigurationManager.AppSettings[ "WordDoc "];//修改后路径
protected void Button3_Click(object sender, EventArgs e)
{
try
{
Open(modWord);
GotoBookMark( "收文时间 ");
InsertText(labSWSJ.Text.Replace( " ", " "));
GotoBookMark( "期刊号 ");
InsertText(labQKH.Text);
SaveAs(docWord);
QuitWord(oldWordApplic);
//Open(docWord);
//KillWord();
DownWord();
}
catch (Exception ex)
{
//KillWord();
throw new Exception(ex.Message);
}
}
protected void DownWord()
{
FileStream fs = new FileStream(docWord, FileMode.Open, FileAccess.Read);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Flush();
fs.Close();
Response.ContentType = "Application/msword ";
Response.AddHeader( "Content-Disposition &