WordDocument document = new
WordDocument(@"../../../Input.docx");
List<Entity>
checkBoxes = document.FindAllItemsByProperty(EntityType.CheckBox, null,
null);
foreach
(Entity entity in checkBoxes)
{
WCheckBox
checkBox = (WCheckBox)entity;
checkBox.SizeType
= CheckBoxSizeType.Exactly;
checkBox.CheckBoxSize
= 20;
}
List<Entity>
textFormFields = document.FindAllItemsByProperty(EntityType.TextFormField,
null, null);
foreach
(Entity entity in textFormFields)
{
WTextFormField
textFormField = (WTextFormField)entity;
textFormField.Text
= "Adventure work cycles";
Entity
currentEntity = textFormField;
//Iterates
to sibling items until Field End
while
(currentEntity.NextSibling != null)
{
if
(currentEntity is WTextRange)
//Sets
character format for text ranges
(currentEntity
as WTextRange).CharacterFormat.FontSize = 30;
else
if ((currentEntity is WFieldMark) && (currentEntity as
WFieldMark).Type == FieldMarkType.FieldEnd)
break;
//Gets
next sibling item.
currentEntity
= (Entity)currentEntity.NextSibling;
}
}
document.Save(@"../../../Result.docx");
|