daily pastebin goal
71%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top