Guest User

Untitled

a guest
Jan 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. object filePath;
  2. Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
  3. dlg.Filter = "Word 2007 file|*.docx |Word 2003 doc|*.doc";
  4. Nullable<bool> result = dlg.ShowDialog();
  5. filePath = dlg.FileName;
  6.  
  7. object typeMissing = Type.Missing;
  8.  
  9. Documents documents = application.Documents;
  10.  
  11. _Document document = documents.Open(ref filePath, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing, ref typeMissing);
  12.  
  13. //Read the table
  14. Range range = document.Tables[1].ConvertToText();
  15.  
  16. object[,] dataArray = (object[,])range.get_Value(Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault);
Add Comment
Please, Sign In to add comment