Inserting text in the field using ASPOSE.words API

Hi Aspose Team,
Here is the scenario where i need to use aspose.words API to generate output in docx format.
I have a RTF template which include details of the person in the page and it has field like first name , last name, address & mobile number. so using this API i need to fill those details with data in the appropriate fields.

Example… RTF template has

About us: …Some text…

I need to fill the details in those appropriate field using this API in the template.

Detials: XXXX
First_ Name: XXXX
Last_name:XXX
Mobile Number:XXXX Country : XXX

Hi Mahesh,

Thanks for your inquiry. You can replace those markers with new text by using the “Find and Replace” capabilities of Aspose.Words or if you are using merge fields then you can use “mail merge” capabilities of Aspose.Words. Please let me know if I can be of any further assistance.

Best regards,

Hi Awais thanks for the respose, as per the requirement all the mark ups are in the table field and there of same kind so how could i find the appropriate field mark up to place the data.

For Example
First name as :XXXX
:ast Name :XXXX
so how would i know which one is correct field to place the data, because data is coming as input from UI

Hi Mahesh,

Thanks for your inquiry. I think, you can get text content from previous cell using Cell.ToString(SaveFormat.Text), compare if it is “First name” or “Last name” string and then replace corresponding “XXXX” in next Cell. In case the problem still remains, please attach your input Word document here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Thanks for the response.

I am attaching a rtf file to this mail where i need to replace those field with the input data and i have attach the excepted outfile… so after using the API the output should similar to the outputfile.doc

Hi Mahesh,

Thanks for your inquiry. I would suggest you please try to understand Document structure first. Please refer to the articles mentioned in following page:

https://docs.aspose.com/words/java/aspose-words-document-object-model/

I hope, after reading those articles you’ll be able to modify document content.

Best regards,