Hi There,
I am using an evaluation version of Aspose.Words 5.0.1.
I have a problem inserting values in Form Text Input fields. After inserting the desired values and open the generated document everything seems to be ok. But trying to print the generated document, the replaced fields are flush out, loosing so all replaced text values and become as the original status except the checkboxes.
Here I send my code example, I have simplified it to relieve just the problem.
Attached you’ll see my template being used as well as the generated document for you to see.
I appreciate beforehand your help.
Kind regards,
Joshua
Document oDoc = new Document(System.IO.Path.Combine(DocPath, "VorlageEinreisegesuchDrittstaaten.doc"));
InsertTextBM(oDoc, "txtFamilienname", "Bachmann");
InsertTextBM(oDoc, "txtGeburtsname", "Bachmann");
InsertTextBM(oDoc, "txtVorname", "Peter");
InsertTextBM(oDoc, "txtGeburtsdatum", "1-Nov-2005");
InsertTextBM(oDoc, "xtStaatsAng", "USA");
InsertTextBM(oDoc, "txtStaatsAngVater", "United Kingdom");
InsertTextBM(oDoc, "txtStaatsAngMutter", "Germany");
InsertTextBM(oDoc, "Zivverheiratet", "Germany", true);
InsertTextBM(oDoc, "rbMale", "Germany", true);
oDoc.Save("DemosII.doc", SaveFormat.Doc);
public void InsertTextBM(Document oDoc, string placeHolder, string replaceText)
{
FormFieldCollection documentFormFields = oDoc.Range.FormFields;
FormField docField = documentFormFields[placeHolder];
if (docField != null && docField.Type == FieldType.FieldFormTextInput)
{
docField.Result = replaceText;
}
}
public void InsertTextBM(Document oDoc, string placeHolder, string replaceText, bool chkChecked)
{
FormFieldCollection documentFormFields = oDoc.Range.FormFields;
FormField docField = documentFormFields[placeHolder];
if (docField != null)
{
if (docField.Type == FieldType.FieldFormCheckBox)
docField.Checked = chkChecked;
}
}