Free Support Forum -

How to disable gray patches created by text form field

Order ID: 060117055358

Order Date: 1/17/2006

Above is my account information. Right now Im using Aspose word.

In my project I have to create word documents with information fetched from database dynamically. for this I used "Text form field" in word document and Im also able to fetch the information from the database.

The problem is after the document is generated, all text form field's text is marked with grey background, and looks like it has been highlighted with a grey marker (for convenience lets call it a grey patch) . Well it should not show grey paches after document is generated.

Secondly it dont allow me to edit text generated by text form field, as I couldnot place the cursor in between the gray patch. And let me tell you that I have to do a hell lot to editing after the documents are generated, and this problem makes my work to slow down and suffer. Also if I use form field shading, it removes the grey color but again dont let me to edit the text, just opens the "text form fields option ". So please tell me way, through which I can disable these gray patches after the document is generated so that i would be able to edit the text in the grey patch also using mouse pointer..



We need some additional data from you to be able to reproduce the problem. Please attach the template document (if any), the code snippet used for document generation and the resulting document.

Best regards,


Attached is a generated document from below code sniplet. In this document u will notice that u cannot edit the data generated after the document is processed. Like try clicking on the date, and you wont be able to edit it, as the whole gray patch get selected without placing cursor anywhere.

Sp lease just let me know that how can I disable the gray patches, or even without disabling them, how can I edit the generated data.

Public Function ProcessDocument(ByRef WordDoc As Object)

Dim fld As FormField

For Each fld In WordDoc.Range.FormFields

Select Case fld.Name

Case "Date"

fld.Result = DateTime.Today

Case "ApCountry"

fld.Result = "India"

End Select


'Gray patches' is a normal way in which MS Word displays form fields. To edit formfield data in your template you should double-click the 'grey patch'. The form field dialog will be opened in which you can make all the settings for the formfield. To edit form field data in a normal way, by putting caret in the text and edit it, you need to protect your document first. Use Tools | Protect Document command in MS Word and set 'filling in forms' type of protection. Please mind that grey patches are shown only to highlight form fields. They won't appear in the printout.

Also if you need just to fill data from the database to a template document please consider using mail merge instead. Working with mail merge is described in Aspose.Words programmer's guide.

Please let me know if you need further guidance. I will be happy to assist you with whatever I can.

Best regards,