Free Support Forum - aspose.com

Reg:how can I extract word file and insert into sql db

Sir/Madam,
I am Umesh here. We are planning to develop a tool(.NET, ASP.NET 3.5) by using ASPOSE Technology.
Our requirement is
1. Extracting data from word file which contains controls like textbox, checkbox, etc (row by row) and insert into SQL database.
2. We require download the same doc file and work offline and upload the database(sql).
If it is possible I request you to send sample code for the same. So please help for this issue. Waiting for your valuable comments.
Thanks and Regards,
Umesh.U

This message was posted using Email2Forum by ShL77.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Of course, you can achieve this using Aspose.Words. In your case, you can use form fields to achieve this:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/working-with-form-fields.html

You can build your document in MS Word and insert form fields in it. Then, I think, you should protect this document in order to allow the end user to modify only form fields in the document (see that attached example.)

Once your end user fill form fields with data and upload the document back to the server, you can read data from the form fields using Apsose.Words. Here is code example:

// Open document.

Document doc = new Document(@"Test001\in.doc");

// Get data from form fields.

// Text inputs

string firstName = doc.Range.FormFields["FirstName"].Result;

string lastName = doc.Range.FormFields["LastName"].Result;

// Combobox

string gender = doc.Range.FormFields["Gender"].Result;

// Checkbox.

bool isMaried = doc.Range.FormFields["IsMaried"].Checked;

// Here is your DataBase staff to write these data into your DB.

// .................................

Hope this helps.

Best regards.