472,133 Members | 1,183 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

Parse Word document to upload data to database

hi dudes

can anyone there guide me in parsing word document to upload the data from word doc to d/b using ruby on rails... It would be helpful if i get a sample description of that code...
Jun 11 '09 #1
2 6119
16,027 Expert Mod 8TB
I've moved your post to the correct place, so that the experts can have a look at it and perhaps provide some clues. Oh, and welcome to Bytes!

Jun 14 '09 #2
303 Expert 100+
You can use win32ole to parse the Word documents, then just grab the text and save it in the database. Here's an example for getting text out of a Word document:
Expand|Select|Wrap|Line Numbers
  1. require 'win32ole'
  2. word = WIN32OLE.new('word.application')
  3. word.documents.open(path_to_file)
  5. # select whole text
  6. word.selection.wholestory
  8. # read the selection
  9. puts word.selection.text.chomp
  11. # close document
  12. word.activedocument.close( false ) # no save dialog, just close it
  14. # quit word
  15. word.quit
Jun 15 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by jmar | last post: by
5 posts views Thread by AdrianH | last post: by
1 post views Thread by AdrianH | last post: by
8 posts views Thread by Christiano | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.