Aspose.Words for .NET를 사용하여 채울 수 있는 필드가 있는 대화형 양식 만들기
채용 가능한 필드를 가진 상호 작용 양식은 사용자가 Word 문서에 직접 데이터를 입력할 수 있습니다. Aspose.Words for .NET를 사용하면 이러한 양식을 프로그래밍적으로 설계하여 설문 조사, 응용 프로그램 또는 데이터 수집을 위해 역동적이고 쉽게 배포할 수 있습니다.
원칙 : 상호 작용 형식을 설계하는 도구
- 설치할 수 있는 넷 SDK 당신의 운영 체제에 대 한.
- 프로젝트에 Aspose.Words를 추가하십시오 :
dotnet add package Aspose.Words
- Word 문서 템플릿을 준비하거나 새 문서를 프로그래밍으로 만드십시오.
단계별 인터랙티브 모양 디자인 가이드
단계 1 : 새로운 단어 문서를 만들기
using System;
using Aspose.Words;
class Program
{
static void Main()
{
// Create a new document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Save the empty document
doc.Save("InteractiveFormTemplate.docx");
Console.WriteLine("Blank form template created successfully.");
}
}
설명: 이 코드는 새 흰색 Word 문서를 만들고 “InteractiveFormTemplate.docx"로 저장합니다.
단계 2 : 양식에 채울 수있는 필드를 추가합니다.
using System;
using Aspose.Words;
using Aspose.Words.Fields;
class Program
{
static void Main()
{
Document doc = new Document("InteractiveFormTemplate.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
// Add a text input field
builder.Writeln("Name:");
builder.InsertTextInput("NameField", TextFormFieldType.Regular, "", "", 0);
// Add a dropdown field
builder.Writeln("Select a department:");
builder.InsertComboBox("DepartmentField", new[] { "HR", "IT", "Finance" }, 0);
// Add a checkbox
builder.Writeln("Agree to Terms:");
builder.InsertCheckBox("AgreeField", false, 0);
// Save the form
doc.Save("InteractiveForm.docx");
Console.WriteLine("Interactive form created successfully.");
}
}
설명: 이 코드는 Word 문서에 텍스트 입력 필드, 다운로드 필드 및 체크 상자를 추가하고 “InteractiveForm.docx"로 저장합니다.
단계 3: 인구 및 양식 데이터를 프로그래밍으로 저장
using System;
using Aspose.Words;
class Program
{
static void Main()
{
Document doc = new Document("InteractiveForm.docx");
// Populate form fields
doc.Range.FormFields["NameField"].Result = "John Doe";
doc.Range.FormFields["DepartmentField"].DropDownSelectedIndex = 1; // Select "IT"
doc.Range.FormFields["AgreeField"].Checked = true;
// Save the filled form
doc.Save("FilledInteractiveForm.docx");
Console.WriteLine("Form fields populated and saved successfully.");
}
}
설명: 이 코드는 “InteractiveForm.docx” 문서를 열고, 양식 필드를 데이터로 인식하고, “FilledInteractiveForm.docx"로 저장합니다.
단계 4: 배포를 위해 양식을 PDF로 변환
using System;
using Aspose.Words;
class Program
{
static void Main()
{
Document doc = new Document("FilledInteractiveForm.docx");
// Save the form as a PDF
doc.Save("InteractiveForm.pdf", SaveFormat.Pdf);
Console.WriteLine("Interactive form converted to PDF for distribution.");
}
}
설명: 이 코드는 “FilledInteractiveForm.docx” 문서를 열고 “InteractiveForm.pdf"라는 PDF 파일로 변환합니다.
인터랙티브 형식에 대한 실제 세계 응용 프로그램
리뷰 및 피드백:- 빠른 데이터 수집을 위해 채울 수 있는 필드를 가진 설문 조사를 배포합니다.
신청서에 대한 자세한 내용은:- dropdowns 및 텍스트 입력으로 일자리 신청 또는 회원 양식을 만드십시오.
조회수:- 조건 및 조건에 대한 체크 상자와 함께 디자인 양식.
인터랙티브 형식에 대한 배치 시나리오
기업 포털:- 내부 시스템 내에서 형태의 창조 및 분배를 자동화합니다.
웹 플랫폼:- 사용자 제출을위한 웹 응용 프로그램에 양식 생성을 통합합니다.
상호 작용하는 형태에 대한 일반적인 문제 및 고정
지원되지 않은 형식 필드:- 호환성을 위해 텍스트, dropdowns 및 체크 상자와 같은 표준 양식 필드를 사용하십시오.
질문에 대한 자세한 내용은:- 전문적인 모습을 보장하기 위해 조정 및 스타일.
불완전한 데이터 인구:- 모든 필드가 프로그래밍적으로 인구화 된 값으로 올바르게 맵링되어 있는지 확인합니다.
.NET에서 Aspose.Words와 상호 작용하는 양식을 설계함으로써 데이터 수집을 최적화하고 다양한 작업 흐름에 대한 문서 사용 가능성을 향상시킬 수 있습니다.