ExportFormFields

HtmlFixedSaveOptions.ExportFormFields property

Gets or sets indication of whether form fields are exported as interactive items (as ‘input’ tag) rather than converted to text or graphics.

public bool ExportFormFields { get; set; }

Examples

Shows how to export form fields to Html.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertCheckBox("CheckBox", false, 15);

// When we export a document with form fields to .html,
// there are two ways in which Aspose.Words can export form fields.
// Setting the "ExportFormFields" flag to "true" will export them as interactive objects.
// Setting this flag to "false" will display form fields as plain text.
// This will freeze them at their current value, and prevent the reader of our HTML document
// from being able to interact with them.
HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions
{
    ExportFormFields = exportFormFields
};

doc.Save(ArtifactsDir + "HtmlFixedSaveOptions.ExportFormFields.html", htmlFixedSaveOptions);

string outDocContents = File.ReadAllText(ArtifactsDir + "HtmlFixedSaveOptions.ExportFormFields.html");

if (exportFormFields)
{
    Assert.True(Regex.Match(outDocContents,
        "<a name=\"CheckBox\" style=\"left:0pt; top:0pt;\"></a>" +
        "<input style=\"position:absolute; left:0pt; top:0pt;\" type=\"checkbox\" name=\"CheckBox\" />").Success);
}
else
{
    Assert.True(Regex.Match(outDocContents,
        "<a name=\"CheckBox\" style=\"left:0pt; top:0pt;\"></a>" +
        "<div class=\"awdiv\" style=\"left:0.8pt; top:0.8pt; width:14.25pt; height:14.25pt; border:solid 0.75pt #000000;\"").Success);
}

See Also