1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Application app = new Application();
Document doc = new Document();
object filename = @"C:\Documents and Settings\plop\Bureau\Txplan\docWord.docx";
doc = app.Documents.Open(ref filename);
Microsoft.Office.Interop.Word.Table tbl = doc.Tables[1];
try {
for (int i = 1; i < tbl.Rows.Count; i++) {
for (int a = 1; a < tbl.Columns.Count; a++) {
Console.WriteLine(tbl.Cell(i, a).Range.Text);
}
}
Console.ReadLine();
} catch {
Console.WriteLine("Fail ...");
Console.ReadLine();
}
doc.Close();
app.Quit(); |
Partager