跳過到頁腳內容
使用 IRONWORD

如何使用 IronWord 在 C# 中建立可填寫的表格範本

使用IronWord庫,透過建立基於表格的佈局和占位符文字字段,在 C# 中建立可填寫的 Word 表單範本。 然後,您可以透過程式設計方式向其中填入實際數據,並可選擇將其轉換為 PDF 格式。

透過結構化表格收集資訊對於各行各業的資料收集至關重要——從人力資源部門處理求職申請到醫療保健提供者收集患者資訊。 在.NET應用程式中,以程式設計方式建立可填寫表單範本可以節省時間並確保 Word 文件之間的一致性。 本教學課程示範如何使用 C# 和IronWord (一個用於產生和編輯 DOCX 檔案而無需 Microsoft Office 相依性的 .NET Word 函式庫)在 Word 文件中建立可填寫表單範本。 最後,您將獲得一個完整的求職申請表模板,可以填寫數據,甚至可以將 Word 文件轉換為 PDF 格式進行分發。

Word文件中的可填寫表單範本是什麼?

可填寫表單範本是結構化的 Word 文檔,其中設計有使用者可以輸入文字和其他資料的特定區域。 這些範本使用表格和占位符文字欄位來建立有序的佈局,您可以透過程式設計方式或透過互動式表單手動填入實際資料。 使用.NET應用程式時,您可以將IronWord等程式庫與 IronPDF 等其他Iron Software產品結合使用,以產生 PDF 文件,從而建立完整的文件自動化解決方案。

Microsoft Word 支援各種互動式欄位的內容控制項,包括純文字內容控制項、富文本內容控制項、複選框內容控制項、下拉式清單內容控制項、組合框內容控制項、日期選擇器內容控制項和圖片內容控制項。 雖然原生表單欄位可以建立互動式表單,但使用佔位符文字的基於範本的方法可以為 Web 應用程式和伺服器環境中的文件產生提供更大的靈活性。 這種靈活性在建立企業工作流程時尤其有用,該工作流程需要處理PDF 數位簽章或其他文件類型以及 Word 表單。

常見應用包括:

  • 附有可填寫欄位的求職申請表和員工入職表格
  • 用於資料收集的客戶註冊和回饋調查
  • 帶有文字方塊和複選框控制項的醫療資訊收集和知情同意書
  • 帶有可變文字欄位的合約模板
  • 可匯出為 PDF 文件的訂單表格和發票

這些表格的結構化特性使它們非常適合自動化處理。 基於範本的表單產生功能可讓您的應用程式從單一主範本產生數十個或數百個一致的文檔,從而減少錯誤並消除重複的人工工作。 同樣的方法可以從簡單的單部分錶單擴展到具有條件邏輯、驗證規則和分支結構的多頁文件。

如何透過NuGet安裝IronWord ?

要開始使用IronWord,請建立一個新的.NET控制台應用程式並安裝該程式包。 您可以使用.NET CLI從NuGet安裝IronWord

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

或者,您也可以在 Visual Studio 中透過NuGet套件管理器搜尋"IronWord"進行安裝。這個.NET Word 庫無需在您的系統上安裝 Microsoft Office 或 Word Interop 即可運行,因此適用於 Office 不可用的伺服器端和雲端部署環境。

 Visual Studio 中的NuGet套件管理器窗口,顯示IronWord套件的搜尋結果和安裝介面

安裝完成後,在進行任何 API 呼叫之前,請新增許可證金鑰。 您可以從IronWord授權頁面取得免費試用金鑰,或直接在程式碼中設定金鑰:

using IronWord;

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

License.LicenseKey = "YOUR-LICENSE-KEY";
$vbLabelText   $csharpLabel

安裝並獲得許可後,您就可以透過程式設計方式建立表單範本了。

如何在 C# 中建立可填寫表單範本?

如何使用表格和占位符建立表單?

表格為組織良好的表單佈局提供了基礎,並能確保表格單元格正確對齊。 文件物件用於為 Word 文件新增表格和表單網域。 以下程式碼範例示範如何使用IronWord 的文件 API建立帶有標籤和輸入佔位符的基本表單結構:

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
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 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
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 with descriptive name
doc.SaveAs("JobApplicationTemplate.docx");
Console.WriteLine("Form template created successfully!");
$vbLabelText   $csharpLabel

這段程式碼使用 WordDocument 類別建立新的文件實例,並使用 Table 類別建立結構化表單。 每一行的第一個儲存格包含一個標籤,第二個儲存格包含一個佔位符(用花括號括起來)。 TextContent 類別處理純文字內容,而 TextStyle 應用程式格式。 佔位符語法 {FieldName} 標記稍後將用實際資料取代文字的區域。 有關邊框、底紋和列寬等進階格式設定選項,請參閱IronWord文件

Microsoft Word 文檔,顯示一份已填寫的求職申請表,其中包含個人資訊、職位詳情和教育背景等字段,這些字段已填充佔位符文本

Microsoft Visual Studio 偵錯控制台顯示綠色文字的

多部分錶單的最佳實踐是什麼?

以下程式碼範例示範如何建立一個包含多個部分的完整求職申請表。 輔助方法可以減少重複工作,並使範本易於擴展,例如添加工作經驗或推薦人等其他部分:

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
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
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, "高的est 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("Applicant certifies 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
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
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, "高的est 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("Applicant certifies 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)));
}
$vbLabelText   $csharpLabel

這段程式碼創建了一個多部分錶單模板,該模板被組織成邏輯部分。 輔助方法 AddSectionHeaderSetFormRow 減少了程式碼重複。 Table 建構函數接受行和列參數,而 RowsCells 集合提供單一表格單元格的存取。 每個部分都包含一個樣式化的標題,後面跟著一個有可填寫欄位的表格。 這種模組化方法使得根據需求變化輕鬆新增日期選擇器欄位、下拉式清單選項或複選框部分。 您也可以使用圖片控制項嵌入影像,使用日期控制項新增日期選擇器欄位。 有關在IronWord中處理段落的更多信息,請參閱操作指南。

Microsoft Word 文檔,顯示求職申請表模板,包含姓名、電子郵件地址、電話號碼和申請日期等字段,表格格式

如何使用資料填入表單範本?

什麼是文字替換方法?

範本建立完成後,使用文字替換即可輕鬆填入實際資料。 以下程式碼片段示範如何透過載入範本檔案並遍歷所有文字元素來填入表單中的範例申請人資訊:

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!");
$vbLabelText   $csharpLabel

文字元素的 Replace 方法會將佔位標記與實際值交換。 使用字典可以保持資料井然有序,並簡化從資料庫、API 或 Web 應用程式中的使用者輸入填充表單的過程。 Texts 屬性提供對文件中所有文字內容的訪問,而 ForEach 遍歷每個文字元素以執行替換。 這種模式非常適合從單一範本產生多個個人化文件——非常適合批次處理場景,例如一次性為多名候選人產生錄用通知書。

Microsoft Word 文檔,顯示已填寫完整求職申請表,佔位符欄位中已填寫實際資料

如何確保表格已填寫完整?

填寫完表格後,您可以透過對 Word 文件套用保護來提高文件安全性。 這包括設定唯讀限制和密碼要求等保護措施,確保只有授權使用者才能修改內容。 處理敏感資料(例如個人識別號碼、財務資訊或醫療記錄)時,安全考慮至關重要。 考慮實施額外的安全層,例如對靜態資料和傳輸中的資料進行加密、對表單存取進行稽核日誌記錄,以及對不同類型的使用者實施基於角色的權限控制。

對於需要可驗證審計追蹤的文檔,請考慮將完成的 Word 表單轉換為 PDF,並使用IronPDF套用PDF 數位簽章。 這種組合——使用 Word 進行創作,使用 PDF 進行分發——在金融和醫療保健等受監管行業中是一種常見的模式。

如何將可填寫 Word 表單轉換為 PDF?

將可填寫 Word 表單轉換為 PDF 是使您的表單能夠被普遍存取和輕鬆共享的重要步驟。 借助IronWord等.NET Word 庫,您可以有效地將包含表單域的 Word 文件轉換為 PDF 文件。 該過程包括加載您的 Word 文檔,訪問其表單域,並使用庫的轉換方法生成保留所有內容的 PDF 文件。

產生的 PDF 文件保留了表單內容,使用者可以用任何標準 PDF 檢視器查看,無需 Microsoft Word 或專用軟體。 這對於需要廣泛分發表格的組織來說尤其有用,可以確保表格在不同平台和裝置上的相容性。 透過使用.NET Word 庫的轉換功能,您可以在 Word 中建立專業表單,並將其轉換為 PDF 以便最終分發,從而簡化您的工作流程並提高可存取性。

選擇 PDF 轉換方法時,請考慮下表所列的因素:

.NET中 Word 轉 PDF 轉換方法的比較
方法 辦公室要求 伺服器端安全 富達
Microsoft Office Interop 是的 高的
IronWord + IronPDF 是的 高的
LibreOffice 無頭模式 是的(Linux) 中等的
Aspose.Words 是的 高的

對於需要處理多種文件類型的企業部署,請查看IronWord授權選項,並考慮購買涵蓋整個文件處理堆疊的套件授權。

如何分發可填寫PDF文件?

建立可填寫 PDF 檔案後,分發給使用者既簡單又靈活。 您可以透過電子郵件分享可填寫的 PDF 文件,將其嵌入到 Web 應用程式中,或上傳到 Dropbox 或 Google Drive 等雲端儲存服務。這樣,使用者就可以輕鬆下載 PDF 文件,使用 Adob​​e Acrobat Reader 等 PDF 檢視器填寫表單,然後以電子方式傳回填寫好的文件。

這種數位化分發流程不僅加快了資料收集速度,而且消除了對紙本文件的需要,使其成為遠端團隊和線上工作流程的理想選擇。 無論您是收集求職申請、客戶回饋還是註冊訊息,分發可填寫的 PDF 文件都能確保您的組織和受訪者獲得流暢、高效和無紙化的體驗。

考慮實施自動化工作流程,以便在表單可用時通知收件者、追蹤完成狀態並傳送待提交表單的提醒。 與電子郵件行銷平台整合可以簡化批量分發,同時透過合併欄位保持個人化。 關於設計有效的數位表單的背景知識, W3C Web Forms 指南微軟的 DOCX Open XML 規範都提供了有關標準合規性的有用背景資訊。

如何實現進階表單功能?

為了進一步改進可填寫表單,可以考慮添加邏輯和驗證等進階功能。 邏輯功能可讓您建立可根據使用者輸入動態回應的互動式表單。 例如,您可以根據先前的回答顯示或隱藏某些部分,或僅在滿足特定條件時啟用某些欄位。 驗證可確保使用者輸入的資料符合您的要求,例如強制執行正確的日期格式、必填欄位或有效的電子郵件地址。

許多.NET Word 庫支援透過程式碼建立這些高級功能,使您能夠建立複雜的表單來引導使用者並減少錯誤。 透過將邏輯和驗證整合到 Word 文件範本中,您可以建立互動式表單,這些表單不僅可以收集數據,還可以提高所接收資訊的品質和一致性。 高階實作方式可能包括:

  • 自動計算總計或應用公式的計算字段
  • 條件格式,反白顯示必填欄位或錯誤
  • 支援多語言,並帶有動態欄位標籤和說明
  • 與外部資料來源集成,實現即時驗證
  • 使用正規表示式或業務邏輯的自訂驗證規則
  • 顯示表單完成百分比的進度指示器

對於複雜的表單場景,可以考慮實作表單建構器介面,讓非技術使用者無需編寫程式碼即可建立和修改範本。 這種方法支援大型組織內靈活的表單管理,使業務團隊能夠維護自己的模板,而開發人員則可以專注於資料管道。 IronWord範例IronWord展示了處理文字樣式、表格邊框和文件屬性的其他技巧,這些技巧在建立進階範本時非常有用。

在建立驗證邏輯時,請遵循.NET中已建立的輸入驗證模式,以保持程式碼的可維護性和可測試性。 微軟關於OOXML 文件結構的文檔也是理解IronWord產生的底層格式的寶貴參考資料。

下一步計劃是什麼?

使用IronWord在 C# 中建立可填寫表單模板,可以簡化.NET應用程式的文件產生工作流程。 基於表格的佈局方法可以產生專業、結構化的表單,表格單元格對齊正確;而模板替換模式可以有效地從任何來源填充資料。 隨著您的文件自動化需求不斷增長,請瀏覽IronWord操作指南,以了解郵件合併、頁首和頁尾自訂以及多語言文件產生等主題。

立即開始免費試用,探索 IronWord 的完整功能,或購買授權進行生產部署。 有關實施方面的問題,請透過IronWord支援頁面聯絡工程團隊。 查看IronWord API 參考文檔,以了解詳細的類別文檔和高級範例,這些範例示範了複雜的表單場景、多重文件處理和企業級實作。

常見問題解答

什麼是 IronWord?

IronWord for .NET 是一個 .NET Word 函式庫,可讓開發人員在不需要 Microsoft Office 相依性的情況下產生和編輯 DOCX 檔案。

如何使用IronWord在C#中創建可填表單?

您可以通過程式化建構具有基於表格佈局和占位符文本字段的表單範本,然後在運行時用實際數據替換占位符來使用IronWord在C#中創建可填表單。

為何製作可填寫表單範本有好處?

建立可填寫的表單範本是有益的,因為它可以簡化資料收集流程、確保文件的一致性,並在各種應用程式和產業中節省時間。

哪些行業可以從使用可填寫表格範本中獲益?

人力資源、醫療保健等產業,以及任何需要結構化資料收集的領域,都可以從使用可填寫表單範本來有效率地處理申請和收集重要資訊中獲益。

使用IronWord需要安裝Microsoft Office嗎?

不,使用 IronWord 不需要安裝 Microsoft Office。它允許生成和編輯 DOCX 檔案,而無需任何 Microsoft Office 依賴。

IronWord 可以處理大型文件處理嗎?

是的,IronWord 旨在有效處理大規模的文件處理,因此適用於企業級應用程式。

IronWord 使用何種程式語言?

IronWord可與C#一起使用,這使它成為在.NET架構內工作的開發人員的理想選擇。

是否有支援可以將IronWord整合到專案中?

是的,Iron Software提供支援和文檔幫助您將IronWord整合到您的專案中。

IronWord 可以同時用於產生和編輯 Word 文件嗎?

是的,IronWord 既可以用於生成新的 Word 文檔,也可以用於編輯現有的 Word 文檔。

Jordi Bardia
軟體工程師
Jordi 在 Python、C# 和 C++ 上最得心應手,當他不在 Iron Software 展現技術時,便在做遊戲編程。在分担產品测测试,產品開發和研究的责任時,Jordi 為持续的產品改進增值。他说这种多样化的经验使他受到挑战并保持参与, 而这也是他与 Iron Software 中工作一大乐趣。Jordi 在佛罗里达州迈阿密长大,曾在佛罗里达大学学习计算机科学和统计学。

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me