 |
|
เรื่องของ MS.WORD ในโปรแกรม Visual C# คือผมใช้ โปรแกรม Microsoft Visual Studio 2005 (C#)- |
|
 |
|
|
 |
 |
|

Code (C#)
using Microsoft.Win32;
// Check whether Microsoft Word is installed on this computer,
// by searching the HKEY_CLASSES_ROOT\Word.Application key.
using (var regWord = Registry.ClassesRoot.OpenSubKey("Word.Application"))
{
if (regWord == null)
{
Console.WriteLine("Microsoft Word is not installed");
}
else
{
Console.WriteLine("Microsoft Word is installed");
}
}
Credit : http://stackoverflow.com/questions/897633/check-msword-is-installed-in-system
|
 |
 |
 |
 |
Date :
2010-02-26 23:36:22 |
By :
blurEye |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

Code (C#)
object mis = Type.Missing;
object strFileName = (Object)"C:\\WordC\\Doc\\GenWord.doc";
object fileFormat = 1;
Object oTrue = true;
Object oFalse = false;
Word.Application oWord = new Word.Application();
Word.Document oWordDoc = new Word.Document();
oWord.Visible = true;
oWordDoc = oWord.Documents.Add(ref mis, ref mis, ref mis, ref mis);
oWord.Selection.TypeText("Welcome To www.ThaiCreate.Com");
oWordDoc.SaveAs(ref strFileName, ref fileFormat, ref mis, ref mis,
ref mis, ref mis, ref mis, ref mis, ref mis,
ref mis, ref mis, ref mis, ref mis, ref mis,
ref mis, ref mis);
oWordDoc.Close(ref oFalse, ref mis, ref mis);
oWord.Quit(ref mis, ref mis, ref mis);
GC.Collect();
Go to : C# .NET Create Word Document (Windows 7 and Office 2003 , Office Word 2007)
|
 |
 |
 |
 |
Date :
2011-09-08 22:30:03 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|