473,554 Members | 2,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parse Word document to upload data to database

1 New Member
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 6220
acoder
16,027 Recognized Expert Moderator MVP
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 Recognized Expert Contributor
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

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

Similar topics

3
8999
by: lee_j | last post by:
Hi, I have a question below. In the Sql server 2000 I store some word documents.Then I get the data from the database through the asp code and display the word document in IE.The ContentType is "application/msword". My question is how to save the word document which is edited to the database. Thanks for your advice!
10
8930
by: Aj Blosser | last post by:
Hey guys, I have a question for you, I have a setup where I'm sending files through the POST to a php web page, I read the file contents, put that file contents as text into the POST string, and send it on it's way. it works perfectly for text files. However, I can't open a word document like a text file and have it give me the result I...
5
3728
by: jmar | last post by:
I posted a week ago and received one response. I'm looking for the opinion of several experienced .NET people before I proceed so I'm posting again. Sorry for the repost... I am updating a VB4.0 quote generation program to VB.net. The old program takes user inputs, performs calculations, saves the data to Access databases and uses...
3
2093
by: N. Graves | last post by:
I've searched Google for a couple of hours and I did not find an answer to my question. Thanks for your interest! Is there a way to update a table with a new(updated) word Document? I can do this internally to Access but I need an ASP web page to update the word document then allow the user to download the Access database. got any...
6
8632
by: Justin | last post by:
Hi all, i need some help over here... i found the solution to export file from mysql db into *.csv. but is there anyway to convert the contents into *.doc and save in my webserver and providing a link for the end users to download the word file? FYI, the database records are obtained by end users submitting the forms themselve and i saved...
4
12419
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
5
64602
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts,...
1
64038
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts,...
8
1181
by: Christiano | last post by:
Hey there... i've developed an asp.net app where you upload a .DOC file and the application converts it into .html. In my development environment everything worked fine, but when i uploaded, i discovered that my hosting doens't allow me to use Microsoft.Office.Interop.Word Namespace..
0
7600
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7521
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7802
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8042
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6145
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5155
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2020
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1134
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.