Code to modify word document in asp.net 2.0 c#

regarding modifying word document
i.e. adding some value in place of merge field
also to add watermark,header/footer
adding logo
etc
i got some information that aspose provide sol for thisregarding modifying word document
i.e. adding some value in place of merge field
also to add watermark,header/footer
adding logo
etc
i got some information that aspose provide sol for this.Please help.

Hi there,

Thanks for your inquiry. Please read following documentation links for your kind reference.
https://docs.aspose.com/words/net/document-builder-overview/
https://docs.aspose.com/words/net/programming-with-documents/
https://docs.aspose.com/words/net/navigation-with-cursor/

*ddbhutada:

also to add watermark,header/footer*

How to Create Headers Footers using DocumentBuilder
How to Add a Watermark to a Document

*ddbhutada:

i.e. adding some value in place of merge field*

Please read following documentation links about mail merge.
https://docs.aspose.com/words/net/mail-merge-and-reporting/

Hope this answers your query. Please let us know if you have any more queries.

Dear Tahir ,
Thanks for ypur reply ,can u please provide sample code in c# for finding and replacing merge field in word document.

Hi there,

Thanks for your inquiry. Following code example perform a simple insertion of data into merge fields.

// Open an existing document.
Document doc = new Document(MyDir + "MailMerge.ExecuteArray.doc");
// Fill the fields in the document with user data.
doc.MailMerge.Execute(
new string[] { "FullName", "Company", "Address", "Address2", "City" },
new object[] { "James Bond", "MI5 Headquarters", "Milbank", "", "London" });
doc.Save(MyDir + "Out.docx");

If you do not want to use mail merge execute method, please use the DocumentBuilder.MoveToMergeField
method to move the cursor to a position just beyond the specified
merge field and removes the merge field. After moving the cursor, please
write the contents using DocumentBuilder.Write method.

Document doc = new Document(MyDir + "in.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToMergeField("FullName");
builder.Write("James Bond");
doc.Save(MyDir + "Out.docx");

Following code example iterate through all
fields and replace the mail merge fields with mail merge field name. You can insert the contents according to your requirements at the position of mail merge field.

Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
foreach (Field field in doc.Range.Fields)
{
    if (field.Type == FieldType.FieldMergeField)
    {
        String[] fieldcodes = field.GetFieldCode().Trim().Split(new Char[] { ' ' });
        if (fieldcodes[2] != "")
        {
            builder.MoveToMergeField(fieldcodes[2], false, false);
            builder.Write(fieldcodes[2]);
        }
    }
}
doc.MailMerge.DeleteFields();
doc.Save(MyDir + "Out.docx");

Hope this answers your query. Please let us know if you have any more queries.