Skip to footer content
USING IRONWORD

C# Word Fillable Form: Build Professional Form Templates Programmatically Using IronWord

Collecting information through structured forms is essential for data collection across industries—from HR departments processing job applications to healthcare providers gathering patient information. Building fillable form templates programmatically saves time and ensures consistency across Word documents in any .NET application. This tutorial demonstrates detailed steps on how to create a fillable form template in Word documents using C# and IronWord, a .NET Word library for generating and editing DOCX files without Microsoft Office dependencies.

This tutorial demonstrates how to create a fillable form template in Word documents using C# and IronWord, a .NET Word library for generating and editing DOCX files without Microsoft Office dependencies. By the end, you'll have a complete job application form template ready for data population, and you can even convert Word documents to PDF file format for distribution.

What Are Fillable Form Templates in Word Documents?

Fillable form templates are structured Word documents designed with designated areas where users can enter text and other data. These templates use tables and placeholder text fields to create organized layouts that can be populated with actual data programmatically or manually through interactive forms.

Microsoft Word supports various content controls for interactive fields, including plain text content control, rich text content control, check box content control, dropdown list content control, combo box content control, date picker content control, and picture content control. While native form fields create interactive forms, a template-based approach that uses placeholder text offers greater flexibility for document generation in web applications and server environments.

Common applications include:

  • Job applications and employee onboarding forms with fillable fields
  • Customer registration and feedback surveys for data collection
  • Medical intake and consent forms with text box and two check box content controls
  • Contract templates with variable text fields
  • Order forms and invoices that can export to PDF document or fillable PDF

How to Create a Fillable Form Template in C#?

Step 1: Set Up the Project and Install the NuGet Package

Start by creating a new .NET console application in Visual Studio and installing the IronWord NuGet package:

dotnet new console -n WordFormTemplate
cd WordFormTemplate
dotnet add package IronWord
dotnet new console -n WordFormTemplate
cd WordFormTemplate
dotnet add package IronWord
SHELL

Alternatively, install via the NuGet Package Manager in Visual Studio by searching for "IronWord." This .NET Word library works without Microsoft Office or Word Interop installed on your system.

Installation

Step 2: Create the Form Structure with Tables

Tables provide the foundation for well-organized form layouts with proper table cells alignment. The document doc object is used to add tables and form fields to the Word document. The following code examples illustrate how to create a basic form structure with labels and input placeholders:

using IronWord;
using IronWord.Models;

// Apply your license key
License.LicenseKey = "YOUR-LICENSE-KEY";

// Create a new document instance
WordDocument doc = new WordDocument();

// Create the form header
Paragraph header = new Paragraph();
var headerText = new IronWord.Models.TextContent("Job Application Form")
{
    Style = new TextStyle
    {
        TextFont = new Font() { FontFamily = "Arial", FontSize = 24 },
        IsBold = true,
        Color = new Color("#1a1a1a")
    }
};
header.AddText(headerText);
doc.AddParagraph(header);

// Add spacing paragraph
doc.AddParagraph(new Paragraph());

// Create a table for personal information section
Table personalInfoTable = new Table(4, 2);

// Set column labels and placeholder text fields, column dim paragraph in VB.NET
personalInfoTable.Rows[0].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Full Name:")));
personalInfoTable.Rows[0].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{FullName}")));

personalInfoTable.Rows[1].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Email Address:")));
personalInfoTable.Rows[1].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{Email}")));

personalInfoTable.Rows[2].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Phone Number:")));
personalInfoTable.Rows[2].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{Phone}")));

personalInfoTable.Rows[3].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Date of Application:")));
personalInfoTable.Rows[3].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{ApplicationDate}")));

doc.AddTable(personalInfoTable);

// Save the template to a file named with descriptive name
doc.SaveAs("JobApplicationTemplate.docx");
Console.WriteLine("Form template created successfully!");
using IronWord;
using IronWord.Models;

// Apply your license key
License.LicenseKey = "YOUR-LICENSE-KEY";

// Create a new document instance
WordDocument doc = new WordDocument();

// Create the form header
Paragraph header = new Paragraph();
var headerText = new IronWord.Models.TextContent("Job Application Form")
{
    Style = new TextStyle
    {
        TextFont = new Font() { FontFamily = "Arial", FontSize = 24 },
        IsBold = true,
        Color = new Color("#1a1a1a")
    }
};
header.AddText(headerText);
doc.AddParagraph(header);

// Add spacing paragraph
doc.AddParagraph(new Paragraph());

// Create a table for personal information section
Table personalInfoTable = new Table(4, 2);

// Set column labels and placeholder text fields, column dim paragraph in VB.NET
personalInfoTable.Rows[0].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Full Name:")));
personalInfoTable.Rows[0].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{FullName}")));

personalInfoTable.Rows[1].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Email Address:")));
personalInfoTable.Rows[1].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{Email}")));

personalInfoTable.Rows[2].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Phone Number:")));
personalInfoTable.Rows[2].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{Phone}")));

personalInfoTable.Rows[3].Cells[0].AddParagraph(new Paragraph(new IronWord.Models.TextContent("Date of Application:")));
personalInfoTable.Rows[3].Cells[1].AddParagraph(new Paragraph(new IronWord.Models.TextContent("{ApplicationDate}")));

doc.AddTable(personalInfoTable);

// Save the template to a file named with descriptive name
doc.SaveAs("JobApplicationTemplate.docx");
Console.WriteLine("Form template created successfully!");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

This code creates a new document object instance using the WordDocument class and builds a structured form using the Table class. Each row contains a label in the first cell and a placeholder (wrapped in curly braces) in the second cell. The TextRun class handles plain text content, while TextStyle applies formatting. The placeholder syntax {FieldName} marks areas where users enter text that will be replaced with actual data later.

Output

Form Template Output

Console Output

Step 3: Build a Complete Job Application Form

The following code example demonstrates creating a comprehensive job application form with multiple sections. For developers preferring traditional structure, you can wrap this in namespace CreateFormInWord with class Program and static void Main:

using IronWord;
using IronWord.Models;

License.LicenseKey = "YOUR-LICENSE-KEY";

// Create an empty document to start fresh
WordDocument doc = new WordDocument();

// Document title with rich text styling
Paragraph title = new Paragraph();
TextContent titleText = new TextContent("Employment Application Form");
titleText.Style = new TextStyle()
{
    TextFont = new Font() { FontFamily = "Arial", FontSize = 28 },
    IsBold = true
};
// Center the paragraph instead of using TextAlignment on TextStyle
title.Alignment = IronWord.Models.Enums.TextAlignment.Center;
title.AddText(titleText);
doc.AddParagraph(title);
doc.AddParagraph(new Paragraph());

// Section 1: Personal Information with text box style fields
AddSectionHeader(doc, "Personal Information");

Table personalTable = new Table(5, 2);
SetFormRow(personalTable, 0, "Full Name:", "{FullName}");
SetFormRow(personalTable, 1, "Email:", "{Email}");
SetFormRow(personalTable, 2, "Phone:", "{Phone}");
SetFormRow(personalTable, 3, "Address:", "{Address}");
SetFormRow(personalTable, 4, "Date of Birth:", "{DOB}");
doc.AddTable(personalTable);
doc.AddParagraph(new Paragraph());

// Section 2: Position Details - similar to combo box or drop down list selection
AddSectionHeader(doc, "Position Details");

Table positionTable = new Table(3, 2);
SetFormRow(positionTable, 0, "Position Applied For:", "{Position}");
SetFormRow(positionTable, 1, "Available Start Date:", "{StartDate}");
SetFormRow(positionTable, 2, "Desired Salary:", "{Salary}");
doc.AddTable(positionTable);
doc.AddParagraph(new Paragraph());

// Section 3: Education Background
AddSectionHeader(doc, "Education Background");

Table educationTable = new Table(3, 2);
SetFormRow(educationTable, 0, "Highest Degree:", "{Degree}");
SetFormRow(educationTable, 1, "Institution:", "{Institution}");
SetFormRow(educationTable, 2, "Graduation Year:", "{GradYear}");
doc.AddTable(educationTable);
doc.AddParagraph(new Paragraph());

// Section 4: Declaration - certification statement
Paragraph declaration = new Paragraph();
declaration.AddText(new TextContent("I certify that the information provided is accurate and complete."));
doc.AddParagraph(declaration);
doc.AddParagraph(new Paragraph());

Table signatureTable = new Table(1, 2);
SetFormRow(signatureTable, 0, "Signature:", "{Signature}");
doc.AddTable(signatureTable);

// Save template file
doc.SaveAs("CompleteJobApplication.docx");
Console.WriteLine("Complete job application form created!");

// Helper method to add styled section headers
void AddSectionHeader(WordDocument document, string headerText)
{
    Paragraph sectionHeader = new Paragraph();
    TextContent sectionText = new TextContent(headerText);
    sectionText.Style = new TextStyle()
    {
        TextFont = new Font() { FontFamily = "Arial", FontSize = 14 },
        IsBold = true,
        Color = new Color("#333333")
    };
    sectionHeader.AddText(sectionText);
    document.AddParagraph(sectionHeader);
}

// Helper method to populate table cells with label and placeholder
void SetFormRow(Table table, int rowIndex, string label, string placeholder)
{
    table.Rows[rowIndex].Cells[0].AddParagraph(new Paragraph(new TextContent(label)));
    table.Rows[rowIndex].Cells[1].AddParagraph(new Paragraph(new TextContent(placeholder)));
}
using IronWord;
using IronWord.Models;

License.LicenseKey = "YOUR-LICENSE-KEY";

// Create an empty document to start fresh
WordDocument doc = new WordDocument();

// Document title with rich text styling
Paragraph title = new Paragraph();
TextContent titleText = new TextContent("Employment Application Form");
titleText.Style = new TextStyle()
{
    TextFont = new Font() { FontFamily = "Arial", FontSize = 28 },
    IsBold = true
};
// Center the paragraph instead of using TextAlignment on TextStyle
title.Alignment = IronWord.Models.Enums.TextAlignment.Center;
title.AddText(titleText);
doc.AddParagraph(title);
doc.AddParagraph(new Paragraph());

// Section 1: Personal Information with text box style fields
AddSectionHeader(doc, "Personal Information");

Table personalTable = new Table(5, 2);
SetFormRow(personalTable, 0, "Full Name:", "{FullName}");
SetFormRow(personalTable, 1, "Email:", "{Email}");
SetFormRow(personalTable, 2, "Phone:", "{Phone}");
SetFormRow(personalTable, 3, "Address:", "{Address}");
SetFormRow(personalTable, 4, "Date of Birth:", "{DOB}");
doc.AddTable(personalTable);
doc.AddParagraph(new Paragraph());

// Section 2: Position Details - similar to combo box or drop down list selection
AddSectionHeader(doc, "Position Details");

Table positionTable = new Table(3, 2);
SetFormRow(positionTable, 0, "Position Applied For:", "{Position}");
SetFormRow(positionTable, 1, "Available Start Date:", "{StartDate}");
SetFormRow(positionTable, 2, "Desired Salary:", "{Salary}");
doc.AddTable(positionTable);
doc.AddParagraph(new Paragraph());

// Section 3: Education Background
AddSectionHeader(doc, "Education Background");

Table educationTable = new Table(3, 2);
SetFormRow(educationTable, 0, "Highest Degree:", "{Degree}");
SetFormRow(educationTable, 1, "Institution:", "{Institution}");
SetFormRow(educationTable, 2, "Graduation Year:", "{GradYear}");
doc.AddTable(educationTable);
doc.AddParagraph(new Paragraph());

// Section 4: Declaration - certification statement
Paragraph declaration = new Paragraph();
declaration.AddText(new TextContent("I certify that the information provided is accurate and complete."));
doc.AddParagraph(declaration);
doc.AddParagraph(new Paragraph());

Table signatureTable = new Table(1, 2);
SetFormRow(signatureTable, 0, "Signature:", "{Signature}");
doc.AddTable(signatureTable);

// Save template file
doc.SaveAs("CompleteJobApplication.docx");
Console.WriteLine("Complete job application form created!");

// Helper method to add styled section headers
void AddSectionHeader(WordDocument document, string headerText)
{
    Paragraph sectionHeader = new Paragraph();
    TextContent sectionText = new TextContent(headerText);
    sectionText.Style = new TextStyle()
    {
        TextFont = new Font() { FontFamily = "Arial", FontSize = 14 },
        IsBold = true,
        Color = new Color("#333333")
    };
    sectionHeader.AddText(sectionText);
    document.AddParagraph(sectionHeader);
}

// Helper method to populate table cells with label and placeholder
void SetFormRow(Table table, int rowIndex, string label, string placeholder)
{
    table.Rows[rowIndex].Cells[0].AddParagraph(new Paragraph(new TextContent(label)));
    table.Rows[rowIndex].Cells[1].AddParagraph(new Paragraph(new TextContent(placeholder)));
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

This code creates a multi-section form template organized into logical parts. The helper methods AddSectionHeader and SetFormRow reduce code repetition. The Table constructor accepts row and column parameters, while Rows and Cells collections provide access to individual table cells. Each section contains a styled header followed by a table with fillable fields. This modular approach makes it easy to add date picker fields, dropdown list options, or check box content sections as requirements change. You can also use docpicture pic controls to embed images (such as profile photos) and sdtdate date controls to add date picker fields. For advanced setup, you might use new sdtdate to configure a default date or new sdtdropdownlist for menus. In VB.NET, developers would declare these using dim sdt, dim cb, dim sddl, dim date, or dim sdtpicture.

Output

Job Application Form Template Output

How to Fill Form Templates with Data?

Once the template exists, populating it with actual data is straightforward using text replacement. The following code snippet demonstrates filling the form with sample applicant information:

using IronWord;

License.LicenseKey = "YOUR-LICENSE-KEY";

// Load the template document
WordDocument doc = new WordDocument("CompleteJobApplication.docx");

// Define replacement data - example using John Doe as applicant
var applicantData = new Dictionary< string, string>
{
    { "{FullName}", "John Doe" },
    { "{Email}", "john.doe@email.com" },
    { "{Phone}", "(555) 123-4567" },
    { "{Address}", "123 Main Street, Chicago, IL 60601" },
    { "{DOB}", "March 15, 1992" },
    { "{Position}", "Senior Software Developer" },
    { "{StartDate}", "January 15, 2025" },
    { "{Salary}", "$95,000" },
    { "{Degree}", "Bachelor of Science in Computer Science" },
    { "{Institution}", "University of Illinois" },
    { "{GradYear}", "2014" },
    { "{Signature}", "John Doe" }
};

// Replace all placeholders with actual values
foreach (var field in applicantData)
{
    doc.Texts.ForEach(text => text.Replace(field.Key, field.Value));
}

// Save the filled form to a new file
doc.SaveAs("JohnDoe_Application.docx");
Console.WriteLine("Application form filled successfully!");
using IronWord;

License.LicenseKey = "YOUR-LICENSE-KEY";

// Load the template document
WordDocument doc = new WordDocument("CompleteJobApplication.docx");

// Define replacement data - example using John Doe as applicant
var applicantData = new Dictionary< string, string>
{
    { "{FullName}", "John Doe" },
    { "{Email}", "john.doe@email.com" },
    { "{Phone}", "(555) 123-4567" },
    { "{Address}", "123 Main Street, Chicago, IL 60601" },
    { "{DOB}", "March 15, 1992" },
    { "{Position}", "Senior Software Developer" },
    { "{StartDate}", "January 15, 2025" },
    { "{Salary}", "$95,000" },
    { "{Degree}", "Bachelor of Science in Computer Science" },
    { "{Institution}", "University of Illinois" },
    { "{GradYear}", "2014" },
    { "{Signature}", "John Doe" }
};

// Replace all placeholders with actual values
foreach (var field in applicantData)
{
    doc.Texts.ForEach(text => text.Replace(field.Key, field.Value));
}

// Save the filled form to a new file
doc.SaveAs("JohnDoe_Application.docx");
Console.WriteLine("Application form filled successfully!");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

The Replace method on text elements swaps placeholder tokens with actual values. Using a dictionary keeps the data organized and makes it simple to populate forms from databases, APIs, or user input in web applications. The Texts property provides access to all text content in the document object, and ForEach iterates through each text element to perform replacements. This pattern works well for generating multiple personalized documents from a single template—perfect for batch data collection processing.

Output

Filled Form Output

After filling the form, you can enhance document security by applying permission PSD to the Word document. This involves setting protection with 'ProtectionType.AllowOnlyFormFields' and a password, so only form fields can be filled and other editing is restricted.

Converting Fillable Word Forms to PDF

Converting fillable Word forms to PDF is an essential step for making your forms universally accessible and easy to share. With a .NET Word library, such as IronWord, you can efficiently convert Word documents containing form fields into interactive PDF documents. This process involves loading your Word document, accessing its form fields, and using the library’s conversion methods to generate a PDF file that retains all interactive elements.

The resulting PDF document preserves the fillable form fields, allowing users to complete the form using any standard PDF viewer—no need for Microsoft Word or specialized software. This is especially useful for organizations that need to distribute forms widely, ensuring compatibility across different platforms and devices. By leveraging the conversion capabilities of a .NET Word library, you can create professional, interactive forms in Word and seamlessly convert Word documents to PDF for final distribution, streamlining your workflow and enhancing accessibility.

Distributing Fillable PDFs

Once you have created a fillable PDF, distributing it to users is straightforward and highly flexible. Fillable PDFs can be shared via email, embedded in web applications, or uploaded to cloud storage services like Dropbox or Google Drive. This allows users to easily download the PDF, complete the form using a PDF viewer such as Adobe Acrobat Reader, and return the filled document electronically.

This digital distribution process not only accelerates data collection but also eliminates the need for physical paperwork, making it ideal for remote teams and online workflows. Whether you’re collecting job applications, customer feedback, or registration details, distributing fillable PDFs ensures a smooth, efficient, and paperless experience for both organizations and respondents.

Advanced Form Features: Logic and Validation

To further enhance your fillable forms, consider implementing advanced features such as logic and validation. Logic allows you to create interactive forms that respond dynamically to user input—for example, showing or hiding sections based on previous answers, or enabling certain fields only when specific conditions are met. Validation ensures that the data entered by users meets your requirements, such as enforcing correct date formats, mandatory fields, or valid email addresses.

Many .NET Word libraries support the creation of these advanced features through code, enabling you to build sophisticated forms that guide users and reduce errors. By integrating logic and validation into your Word document templates, you can create interactive forms that not only collect data but also improve the quality and consistency of the information received.

Conclusion

Creating fillable form templates in C# with IronWord streamlines document generation workflows for any .NET application. The table-based layout approach produces professional, structured forms with properly aligned table cells, while the template replacement pattern enables efficient data population from any source.

Start your free trial to explore IronWord's full capabilities, or purchase a license for production deployment. For questions about implementation, chat with our engineering team for personalized guidance.

Frequently Asked Questions

What is IronWord?

IronWord is a .NET Word library that allows developers to generate and edit DOCX files without requiring Microsoft Office dependencies.

How can I use IronWord to create fillable forms in C#?

You can use IronWord to create fillable forms in C# by programmatically building form templates, which ensures consistency and saves time in processing Word documents.

Why is creating fillable form templates beneficial?

Creating fillable form templates is beneficial because it streamlines data collection processes, ensures document consistency, and saves time across various applications and industries.

What industries can benefit from using fillable form templates?

Industries such as HR, healthcare, and any field that requires structured data collection can benefit from using fillable form templates to process applications and gather important information efficiently.

Do I need Microsoft Office installed to use IronWord?

No, you do not need Microsoft Office installed to use IronWord. It allows for generation and editing of DOCX files without any Microsoft Office dependencies.

Can IronWord handle large-scale document processing?

Yes, IronWord is designed to efficiently handle large-scale document processing, making it suitable for enterprise-level applications.

What programming language is used with IronWord?

IronWord is used with C#, making it a great choice for developers working within the .NET framework.

Is there support available for integrating IronWord into my project?

Yes, Iron Software offers comprehensive support and documentation to help integrate IronWord into your projects seamlessly.

Can IronWord be used for both generating and editing Word documents?

Yes, IronWord can be used for both generating new Word documents and editing existing ones.

Jordi Bardia
Software Engineer
Jordi is most proficient in Python, C# and C++, when he isn’t leveraging his skills at Iron Software; he’s game programming. Sharing responsibilities for product testing, product development and research, Jordi adds immense value to continual product improvement. The varied experience keeps him challenged and engaged, and he ...
Read More