We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Form Fields not shaded

Hi,
I have this code, but the form field is not gray, not shaded. Why?
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense(“Aspose.Words.lic”);
Document doc = new Document(“c:\work\abcd_4.docx”);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark(“bookmark”);
doc.ShadeFormData = true;
builder.InsertTextInput(“bookmark1”, Aspose.Words.Fields.TextFormFieldType.Regular, “”, “”, 0);
doc.Save(“c:\work\abcd_41.docx”);

Hi Naomi,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 17.6 and have not found the shared issue. Please use Aspose.Words for .NET 17.6.

If you still face problem, please share your input and output documents here for our reference. We will investigate the issue and provide you more information on this.

Best Regards,
Tahir Manzoor

Hi,
Can you please try the code with version 15.12??
Because I don’t see this bug in the list of bugs fixed on the new version
Thanks
Naomi

@naomidu,

Thanks for your inquiry.

Please note that we do not provide support for older versions of Aspose.Words and we do not provide any fixes or patches for old versions of Aspose products either. We always encourage our customers to use the latest version of Aspose.Words (to date it is 17.6) as it contains newly introduced features, enhancements and fixes for issues reported earlier. Thanks for your understanding.

Download latest version of Aspose.Words for .NET

Best regards,
Awais Hafeez

Hi
I tryd it in the new version but , same thing…
It is not shaded.
I would like to see your output shaded, please send me your output document.
Thank you

@naomidu,

Thanks for your inquiry. We tested the scenario using following code example. We have attached the output DOCX with this post. 17.7.zip (5.0 KB)

Please share your input and output documents here for testing. We will investigate the issue and provide you more information on this.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("bookmark");
doc.ShadeFormData = true;
builder.InsertTextInput("bookmark1", Aspose.Words.Fields.TextFormFieldType.Regular, "", "TEST", 0);
doc.Save(MyDir + "17.7.docx");

Best Regards,
Tahir Manzoor

I Cant open the zip file, I get an error - private file, even that I loged in
please sent to e-mail
Thanks

@naomidu,

Thanks for your inquiry. We have sent you the output via email. Please login again and try to download the zip file. Hope this helps you.

Best Regards,
Tahir Manzoor

Hi
Thank you so much, but I want to insert an empty form field (without the text “TEST”) , so my client will insert the data he wants.
I’m suppose to see only gray block with no text in it.
(You can see in my code that I put “” as the text parameter)

@naomidu,

Thanks for your inquiry. We suggest you please use following line of code. The field value contains the empty spaces. Hope this helps you.

builder.InsertTextInput(“bookmark1”, Aspose.Words.Fields.TextFormFieldType.Regular, “”, " ", 0);

Best Regards,
Tahir Manzoor

Hi,
But i don’t want spaces in the value. I want it should work like in WORD
like this image
Untitled.png (18.0 KB)

@naomidu,

Thanks for your inquiry. Please use the value of second last parameter in DocumentBuilder.InsertTextInput method as empty string.

builder.InsertTextInput("bookmark1", Aspose.Words.Fields.TextFormFieldType.Regular, "", "", 0);

If you still face problem, please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.