Description: public static bool CreateWordFile(string dir, string fileName)
{
try
{
Object oMissing = System.Reflection.Missing.Value
if (!Directory.Exists(dir))
{
//创建文件所在目录
Directory.CreateDirectory(dir)
}
//创建Word文档(Microsoft.Office.Interop.Word)
Microsoft.Office.Interop.Word._Application WordApp = new Application()
WordApp.Visible = true
Microsoft.Office.Interop.Word._Document WordDoc = WordApp.Documents.Add(
ref oMissing, ref oMissing, ref oMissing, ref oMissing)
//保存
object filename = dir+ fileName
WordDoc.SaveAs(ref filename, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing)
WordDoc.Close(ref oMissing, ref oMissing, ref oMissing)
Wor
To Search:
File list (Check if you may need any files):
WordOperate.cs