Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Jan 04, 2011 2:37 am

Hello, :lol:
Can I add form field to Word with your product? :roll:
And what formats does it support?
THANKS! :P

james
 
Posts: 8
Joined: Tue Dec 21, 2010 9:29 am

Tue Jan 04, 2011 10:01 am

Thank you for your inquiry.
Yes, you can add form field with Spire .DOC.
The Spire .DOC supports TextFormField, CheckBoxFormField, DropDownFormField.
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Wed Jan 05, 2011 8:58 am

How can I choose options of DropDownFormField, how to check the box from the field and how to fill text in the field?

Finalsky
 
Posts: 13
Joined: Wed Dec 22, 2010 1:12 am

Wed Jan 05, 2011 10:23 am

Choose the options of the field:
"DropDownFormField combox = field as DropDownFormField;
for(int i = 0; i < combox.DropDownItems.Count; i++)
{
if (combox.DropDownItems[i].Text == ""your selected value"")
{
combox.DropDownSelectedIndex = i;
break;
}
}

Check the box of the field:
CheckBoxFormField checkBox = field as CheckBoxFormField;
checkBox.Checked = true;

Add text into the field:
TextFormField textInput = field as TextFormField;
textInput.Text = ""your text"";
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Sun Jan 04, 2015 2:02 am

How insert checkbox at fixed position, for example near by 'this a checkbox' character?

wangjun
 
Posts: 8
Joined: Wed Dec 31, 2014 8:42 am

Mon Jan 05, 2015 7:13 am

Hello,

Sorry for late reply. MS Word document is flow document and does not contain any information about its layout into lines and pages. So there is no way to determine on which page and where on the page some particular node is located. Here is the method to insert checkbox near by 'this a checkbox' character for your reference.
Code: Select all
Document doc = new Document();
Section section = doc.AddSection();
Paragraph para1 = section.AddParagraph();
para1.AppendText("paragraph1");
Paragraph para2 = section.AddParagraph();
para2.AppendText("this a checkbox");
CheckBoxFormField cb = new CheckBoxFormField(doc);
cb.Checked = true;
cb.Name = "Chk1";
para2.Items.Insert(1, cb);
doc.SaveToFile("test.docx", FileFormat.Docx);

If there are any doubt, you could provide us your document and state your requirement, we will provide the corresponding demo for your reference.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc