Free Support Forum - aspose.com

Inserting Form Fields with DocumentBuilder

Hi,

We are currently evaluating Aspose for normal users to be able to create new documents from blocks of paragraphs (maintained by a system manager) and then using mail merge to insert data from various data sources on the main server without the use of Word itself.

We have prototyped most of this but we’ve hit problem with the text control we are using for the system manager’s application. We don’t want to give the any user access to Word to edit the paragraphs and have got a control that gives 95% of the funtionality we need. But we’ve found that it only supports form fields in its native format and not when streamed as a Word doc, which is a mandatory requirement from the customer.

Is it possible with Aspose.Word for us to search within the content for a specific piece of text, and insert a form field in its place so that we run the main merge, the data is merged as normal?

Thanks in advance for your help,

Chris Morrissey
UK Consulting, EDS.

Hi Chris,

Do you want to search inside the document using Aspose.Word? This feature is not yet available, but we are working on it.

Can you get away without searching for a specific text? Maybe you can use one of the DocumentBuilder.MoveToXXX methods like MoveToBookmark to move to a proper position inside the document?

If I understand you correctly you want to be able to insert normal MS Word form fields such as text box, checbox and a combo box, right? I think this is a good requirements and I will add it onto our task list.

Estimated delivery for search and inserting form fields is August-September.

Hi,

Thanks for responding so quickly.

You almost have it right as those fields you have mentioned would be useful but the more important fields would be merge fields.

The reason we want to search in the text itself is when the windows control we want to use saves or streams to the Word format rather than its native one, any merge fields come out as text of just the name of the field. For example if we created a merge field, which would look like “” in Word, the control saves that field as plain text “MyMergeField1”.

We could use bookmarks, but I haven’t tried to see if the control saves the bookmark as a vaild Word bookmark yet. Currently my fall back is to use Word in Automation on the client to do the search and insert of the merge field before it returns back to the server to be processed. Which of course we want to avoid!

Thanks again in advance,

Chris…

If you want to be able to insert merge fields only (as opposed to form fields), we can do this quicker as another customer requested similar functionality.

Hi Again,

If you could add ther functionality to add merge fields, that would be great. We can easily wait on other form fields as the merge fields are much more important. I’ll try the bookmark method to see if we could use that instead of searching for specific text. though that would be the ideal solution.

Thanks,

Chris…

Hi Chris,

I’ve added DocumentBuilder.InsertField method in Aspose.Word 1.6.7 hotfix. It is available for download and online documentation is also updated.

Hi Roman,

Cheers for that and the speed in which you did it. Great. It will be very useful. In the post above you mentioned Aug/Sept timeframe for both the text search and form fields. How long do you reckon for just the search (whic would include move to that point)?

Thanks again,

Chris…

We will do search first. It is technically challenging for us so fuzzy Aug/Sept is a good timeline for us now. Inserting form fields is simple, we will add it later in a couple of days.

I’ve released Aspose.Word 1.6.10 that allows to insert text form fields, check this related topic http://www.aspose.com/forums/ShowPost.aspx?PostID=9067#9223.