C#打開WORD文檔內容並顯示代碼如下:
//在項目引用裡添加上對Microsoft Word
private void button
{
//調用打開文件對話框獲取要打開的文件WORD文件
OpenFileDialog opd = new OpenFileDialog();
opd
opd
opd
if (opd
{
//建立Word類的實例
Word
Word
object missing = System
object FileName = opd
object readOnly = false;
object isVisible = true;
object index =
try
{
doc = app
ref missing
ref missing
ref missing
doc
doc
//從剪切板獲取數據
IDataObject data=Clipboard
this
}
finally
{
if (doc != null)
{
doc
doc = null;
}
if (app != null)
{
app
app = null;[Page]
}
}
}
}
From:http://tw.wingwit.com/Article/program/ASP/201311/21704.html