|
c#操作word表格(13) { object mymissing = System.Reflection.Missing.Value; object myunit = Word.WdUnits.wdStory; wordApp.Selection.EndKey(ref myunit,ref mymissing);
object pBreak= (int)Word.WdBreakType.wdPageBreak; wordApp.Selection.InsertBreak( ref pBreak ); } }
wordDoc.SaveAs(ref filename, ref missing,ref missing, ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing, ref missing); wordDoc.Close(ref Nothing, ref Nothing, ref Nothing); wordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
if ( wordDoc != null ) { System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDoc); wordDoc = null; } if ( wordApp != null ) { System.Runtime.InteropServices.Marshal.ReleaseComObject(wordApp); wordApp = null; } GC.Collect(); //KillWordProcess(); string strUrl = "MakeWordFile.ASPx?username="+Request.QueryString["username"].ToString(); utility.ShowPopMessage("文档生成完毕!",strUrl); } else { utility.ShowPopMessage("无任何数据!"); }
|