Free Support Forum -

Recreation of an existing WordDoc


I want to do the following:

1)Scan a WordDoc

2)Save Part or All Content in a database.

3)Retrieve the same "saved" content and recreate an exact copy of the original WordDoc. This is that all contents are on the same location (x,y-coordinate) as it is in the original document.

4) Is it also possible to seperate "text" from "numerical values" (an amount in a bill)?

5) Is this also possible for PDF and Excel files?

Thank you



Thank you for your interest in Aspose products.

1. You can open and process (change, perform mail merge, find and replace etc) Word document using Aspose.Words.

2. You can store your document into DB as byte array. Here is code example

//read document

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

MemoryStream stream = new MemoryStream();

//save document to memorystream

doc.Save(stream, SaveFormat.Doc);

//create sql command

string commandString = "INSERT INTO Documents VALUES(@Doc)";

System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(commandString, conn);

//add paramenter

command.Parameters.AddWithValue("Doc", stream.GetBuffer());

//write to DB



3. Then you can read byte array from DB and create document from stream. For example see the following code.

//create DataSet

DataSet ds = new DataSet();

//Create sql command

string commandString = "SELECT Document FROM Documents WHERE ID=1";

System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(commandString, conn);

//create adapter

System.Data.SqlClient.SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter(command);


//fill dataset



//save document to hard disk

if (ds.Tables.Count > 0)


if (ds.Tables[0].Rows.Count > 0)


byte[] buffer = (byte[])ds.Tables[0].Rows[0][0];

MemoryStream stream = new MemoryStream(buffer);

Document doc = new Document(stream);




4. I think that you can try using Rexex and ReplaceEvaluator to achieve this. See the following link for more information.

5. Yes, I think that you can achieve this using Aspose.Cels and Aspose.Pdf. You can also ask this question in the corresponding forums.

Please feel free to ask if you have any questions about using Aspose.Words, I will be happy to help you.

Best regards.