引用命名空間
Word = Excel = PowerPoint = Microsoft.Office.Interop.PowerPoint;
Word文件的讀取
text = Word.ApplicationClass app = Word.Document doc = readOnly = missing = fileName =
app = doc = app.Documents.Open( fileName, missing, readOnly, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, text = doc.Content.Text.Replace(, .Empty).Replace(, .Empty).Replace(,
doc.Close( missing, missing, doc = app.Quit( missing, missing, app = }
Excel文件的讀取
text = Excel.ApplicationClass app = Excel.Workbook book = readOnly = missing = fileName =
app = book = (Excel.Worksheet sheet ( i = ; i <= sheet.UsedRange.Cells.Rows.Count; i++ ( j = ; j <= sheet.UsedRange.Cells.Columns.Count; j++ text += ((Excel.Range)sheet.Cells[i, j]).Text.ToString().Replace(, .Empty).Replace(, .Empty).Replace(, .Empty) +
book = app = }
PPT文件的讀取
text = Excel.ApplicationClass app = Excel.Workbook book = readOnly = missing = fileName =
app = book = (Excel.Worksheet sheet ( i = ; i <= sheet.Rows.Count; i++ ( j = ; j <= sheet.Columns.Count; j++ text += ((Excel.Range)sheet.Cells[i, j]).Text.ToString().Replace(, .Empty).Replace(, .Empty).Replace(, .Empty) +
book = app = }