June 15, 2008 at 2:27 am
hi
i want to insert data from word doc to my sql table there are four fields in my
sql table
my word file contain
News
Date
Title
Subject
when i saving the word doc i want to insert the data to sql table contain same field
(News,Date,Title,Subject)
any idea
please replay
June 15, 2008 at 6:11 am
From this web site
http://www.sqlmag.com/Articles/Index.cfm?ArticleID=23911&DisplayTab=Article
Word has no OLE DB provider, so Data Transformation Services (DTS) can't easily access a Word document. Your best bet is to write a VBScript macro to connect Word to SQL Server. Using the VBScript macro, you can load the data directly into SQL Server without using a SQL Server utility.
Alternatively, you can partially automate the import by copying the Word table into Microsoft Excel, then exporting the data to DTS. Follow these steps:
In Word, select a table by clicking the Table Select icon in the table's top left corner, then press Ctrl+C to copy the table.
To convert the table into an Excel row, in Excel, paste the table into a workbook by clicking the top left cell (A1), then pressing Ctrl+V.
To transpose the newly pasted row to a column, copy the row, tab to a new worksheet, click in the A1 cell, click the drop-down arrow on the paste icon, then select the Transpose option. The transposing action turns each row into a column.
Select the data row, then paste it to the end of the master sheet. When all tables have the same form and structure, include the row headers only the first time you paste a row into the sheet.
Repeat Steps 1 through 4 for each Word table.
June 15, 2008 at 9:32 am
It would be far better to use something besides Word as your input GUI. Excel would be a better "poor man's" GUI than Word for this type of thing.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 16, 2008 at 5:59 am
If you must use word, you would need to write some VBA code in the word document to react to the save event of the document. Assuming your users don't move the fields around on you in the document, it would not be terribly difficult.
Of course, unless you lock pretty much everything in the word document so the users cannot move or modify anything, you are going to find keeping track of where your information is difficult. If you lock everything else in the document, it may be much easier to just create a web page with a couple of input boxes.
April 27, 2011 at 10:08 pm
you can try automation library to convery docx file to HTML or txt and then use RegX to parse text line by line.
---------------------------
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply