469,362 Members | 2,548 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

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 6029
acoder
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!

-Moderator
Jun 14 '09 #2
improvcornartist
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)
  4.  
  5. # select whole text
  6. word.selection.wholestory
  7.  
  8. # read the selection
  9. puts word.selection.text.chomp
  10.  
  11. # close document
  12. word.activedocument.close( false ) # no save dialog, just close it
  13.  
  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
AdrianH
5 posts views Thread by AdrianH | last post: by
AdrianH
1 post views Thread by AdrianH | last post: by
8 posts views Thread by Christiano | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.