IRONWORD 사용하기 ASP .NET Core Word 파일 가져오기 및 내보내기 커티스 차우 업데이트됨:9월 18, 2025 다운로드 IronWord NuGet 다운로드 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 이 안내서는 기존 Word 문서를 가져오고, 그 내용을 표시하며, IronWord 라이브러리를 사용하여 처음부터 문서를 만드는 방법을 탐구합니다. 이 튜토리얼이 끝날 때쯤에는 다음을 할 수 있는 ASP.NET Core 웹 애플리케이션을 만들게 됩니다: Word 문서 업로드 및 읽기 이 문서들의 내용을 텍스트박스에 표시하기 Docx 파일 내보내기 이 프로젝트는 문서 관리 시스템, 보고서 생성기 또는 Microsoft Word 파일을 포함하는 기타 시나리오에 대해 Web 애플리케이션에 Word 문서 처리를 통합해야 하는 개발자에게 적합합니다. 필수 조건 이 튜토리얼을 따라가려면 다음이 필요합니다: C# 및 ASP.NET Core 기본 지식 Visual Studio 2019 이상 설치(또는 C# 확장이 있는 Visual Studio Code를 사용할 수 있습니다) .NET Core SDK 3.1 이상 이 기술에 익숙하지 않더라도 걱정하지 마세요 - 과정의 각 단계를 안내해 드리겠습니다! IronWord란? IronWord는 개발자가 Microsoft Word 문서를 프로그래밍적으로 읽고 조작하며 생성할 수 있도록 해주는 .NET 라이브러리입니다. 이는 Word 파일 작업을 단순화하는 고급 API를 제공하여 우리의 프로젝트에 훌륭한 선택이 됩니다. IronWord의 몇 가지 주요 기능은 다음과 같습니다: 다양한 Word 형식(DOCX, DOC 등)의 읽기 및 쓰기 문서 내용 및 구조 조작 텍스트 및 단락 서식 지정 테이블, 이미지 및 기타 문서 요소 작업 문서의 메일 병합 과정 Word 문서를 PDF 문서로 쉽게 변환하여 최종 Word 문서를 손쉽게 공유할 수 있는 PDF 파일로 만들 수 있습니다 이제 우리가 만든 것과 사용할 도구의 개요가 나왔으니, 프로젝트 설정에 대해 깊이 알아보겠습니다! 2. 프로젝트 설정 이 섹션에서는 새로운 ASP.NET Core 프로젝트를 만들고 IronWord를 사용하기 위한 필요한 패키지를 설치할 것입니다. 2.1 새로운 ASP.NET Core 프로젝트 생성 Visual Studio 2019 또는 그 이후 버전을 엽니다. "새 프로젝트 생성"을 클릭합니다. "ASP.NET Core Web Application"을 검색하고 선택합니다. "다음"을 클릭합니다. 프로젝트 이름을 "WordDocumentProcessor"(또는 선호하는 이름)로 지정합니다. .NET Framework와 프로젝트의 위치를 선택하고 "생성"을 클릭합니다. 2.2 IronWord NuGet Install-Package하기 프로젝트 설정이 완료되었으므로, IronWord 라이브러리를 추가하겠습니다: 솔루션 탐색기에서 프로젝트를 마우스 오른쪽 버튼으로 클릭합니다. "NuGet 패키지 관리"를 선택합니다. "검색" 탭에서 "IronWord"를 검색합니다. 공식 IronWord 패키지를 찾습니다. "설치"를 클릭하여 프로젝트에 추가합니다. 2.3 기존 컨트롤러 및 뷰 업데이트하기 문서 처리 기능을 구현하기 위해 기존 구조를 업데이트하겠습니다: 컨트롤러 폴더에 있는 기존 HomeController.cs를 문서 처리 로직에 사용하겠습니다. 뷰/Home 폴더의 기존 Index.cshtml 뷰를 문서 업로드 및 표시 기능을 포함하도록 업데이트하겠습니다. 프로젝트 설정 및 IronWord Install-Package가 완료되었으므로 이제 문서 가져오기 및 내보내기 기능을 구현할 준비가 되었습니다. HomeController에 새 메서드를 추가하고 Index 뷰를 수정하여 이러한 기능을 처리하겠습니다. 다음 섹션에서는 기존 컨트롤러와 뷰 구조를 활용하여 Word 문서를 가져오고 내용을 표시하는 데 중점을 둘 것입니다. 3. Word 문서 가져오기 이 섹션에서는 ASP.NET MVC 애플리케이션에서 Word 문서를 가져오고 처리하는 기능을 구현하는 방법을 탐구합니다. 사용자 인터페이스 설계와 백엔드 컨트롤러 로직을 모두 다룹니다. 3.1 사용자 인터페이스 설계 Word 문서 가져오기를 위한 사용자 인터페이스는 직관적이고 시각적으로 매력적이도록 설계되었습니다. UI의 주요 구성 요소를 살펴보겠습니다: 3.1.1 업로드 영역 업로드 영역은 인터페이스의 중심으로, 사용자가 Word 문서를 선택하고 업로드하도록 유도합니다. 여기서의 구조는 다음과 같습니다: <div class="upload-area"> <svg class="file-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path> <polyline points="14 2 14 8 20 8"></polyline> <line x1="16" y1="13" x2="8" y2="13"></line> <line x1="16" y1="17" x2="8" y2="17"></line> <polyline points="10 9 9 9 8 9"></polyline> </svg> <p>Choose a Word document</p> <label for="fileInput" class="choose-file">Choose File</label> <p class="file-info">.DOC or .DOCX (MAX. 10MB)</p> <button id="uploadBtn" class="upload-button">Upload and Process</button> </div> <div class="upload-area"> <svg class="file-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path> <polyline points="14 2 14 8 20 8"></polyline> <line x1="16" y1="13" x2="8" y2="13"></line> <line x1="16" y1="17" x2="8" y2="17"></line> <polyline points="10 9 9 9 8 9"></polyline> </svg> <p>Choose a Word document</p> <label for="fileInput" class="choose-file">Choose File</label> <p class="file-info">.DOC or .DOCX (MAX. 10MB)</p> <button id="uploadBtn" class="upload-button">Upload and Process</button> </div> HTML 이 코드는 파일 아이콘, 숨겨진 파일 입력과 파일 선택 버튼으로 작동하는 스타일이 적용된 레이블을 포함하여 시각적으로 매력적인 업로드 영역을 만듭니다. 허용되는 파일 유형에 대한 정보와 업로드 및 처리를 시작하기 위한 버튼도 포함됩니다. 3.1.2 콘텐츠 표시 영역 문서 처리가 완료되면 해당 콘텐츠는 전용 영역에 표시됩니다: <div class="content-wrapper"> <h2>Document Content:</h2> <div id="documentContent" class="content-area"> No content to display. </div> </div> <div class="content-wrapper"> <h2>Document Content:</h2> <div id="documentContent" class="content-area"> No content to display. </div> </div> HTML 이 섹션은 처리된 문서 콘텐츠를 표시하기 위한 스크롤 가능한 영역을 제공합니다. 3.2 컨트롤러 구현 HomeController는 Word 문서의 가져오기 및 처리에 대한 서버 측 로직을 처리합니다. 주요 메서드를 살펴보겠습니다: 3.2.1 UploadAndProcess 메서드 이 메서드는 파일 업로드 및 처리를 담당합니다: [HttpPost] public IActionResult UploadAndProcess(IFormFile file) { if (file == null || file.Length == 0) { return Json(new { success = false, message = "No file uploaded." }); } var fileExtension = Path.GetExtension(file.FileName).ToLowerInvariant(); if (fileExtension != ".doc" && fileExtension != ".docx") { return Json(new { success = false, message = "Invalid file type. Please upload a .doc or .docx file." }); } try { var tempFilePath = Path.GetTempFileName(); using (var stream = new FileStream(tempFilePath, FileMode.Create)) { file.CopyTo(stream); } StringBuilder contentBuilder = new StringBuilder(); WordDocument doc = new WordDocument(tempFilePath); foreach (Paragraph paragraph in doc.Paragraphs) { foreach (Text textRun in paragraph.Texts) { contentBuilder.AppendLine(textRun.Text); } contentBuilder.AppendLine(); // Add an extra line between paragraphs } System.IO.File.Delete(tempFilePath); // Clean up the temporary file return Json(new { success = true, content = FormatContentAsHtml(contentBuilder.ToString()) }); } catch (Exception ex) { _logger.LogError(ex, "Error processing document"); return Json(new { success = false, message = "An error occurred while processing the document." }); } } [HttpPost] public IActionResult UploadAndProcess(IFormFile file) { if (file == null || file.Length == 0) { return Json(new { success = false, message = "No file uploaded." }); } var fileExtension = Path.GetExtension(file.FileName).ToLowerInvariant(); if (fileExtension != ".doc" && fileExtension != ".docx") { return Json(new { success = false, message = "Invalid file type. Please upload a .doc or .docx file." }); } try { var tempFilePath = Path.GetTempFileName(); using (var stream = new FileStream(tempFilePath, FileMode.Create)) { file.CopyTo(stream); } StringBuilder contentBuilder = new StringBuilder(); WordDocument doc = new WordDocument(tempFilePath); foreach (Paragraph paragraph in doc.Paragraphs) { foreach (Text textRun in paragraph.Texts) { contentBuilder.AppendLine(textRun.Text); } contentBuilder.AppendLine(); // Add an extra line between paragraphs } System.IO.File.Delete(tempFilePath); // Clean up the temporary file return Json(new { success = true, content = FormatContentAsHtml(contentBuilder.ToString()) }); } catch (Exception ex) { _logger.LogError(ex, "Error processing document"); return Json(new { success = false, message = "An error occurred while processing the document." }); } } $vbLabelText $csharpLabel 이 메서드는 다음 작업을 수행합니다: 업로드된 파일이 올바른 파일 형식(DOC 또는 DOCX)인지 확인합니다. IronWord 라이브러리를 사용하여 문서를 처리합니다. 형식화된 내용을 JSON으로 반환합니다. 3.2.2 FormatContentAsHtml 메서드 이 개인 메서드는 추출된 콘텐츠를 HTML로 형식화합니다: private string FormatContentAsHtml(string content) { var lines = content.Split(new[] { Environment.NewLine }, StringSplitOptions.None); var htmlBuilder = new StringBuilder(); htmlBuilder.Append("<div class='document-content'>"); foreach (var line in lines) { if (string.IsNullOrWhiteSpace(line)) { htmlBuilder.Append("<p> </p>"); } else { htmlBuilder.Append($"<p>{HttpUtility.HtmlEncode(line)}</p>"); } } htmlBuilder.Append("</div>"); return htmlBuilder.ToString(); } private string FormatContentAsHtml(string content) { var lines = content.Split(new[] { Environment.NewLine }, StringSplitOptions.None); var htmlBuilder = new StringBuilder(); htmlBuilder.Append("<div class='document-content'>"); foreach (var line in lines) { if (string.IsNullOrWhiteSpace(line)) { htmlBuilder.Append("<p> </p>"); } else { htmlBuilder.Append($"<p>{HttpUtility.HtmlEncode(line)}</p>"); } } htmlBuilder.Append("</div>"); return htmlBuilder.ToString(); } $vbLabelText $csharpLabel 이 메서드는 문서 콘텐츠를 HTML로 적절하게 형식화하여 각 줄을 문단 태그로 감싸고 빈 줄을 유지합니다. 3.3 클라이언트 측 JavaScript 파일 업로드를 처리하고 처리된 콘텐츠를 표시하기 위해 JavaScript를 사용합니다: uploadBtn.addEventListener('click', () => { const file = fileInput.files[0]; if (!file) { alert('Please select a file first.'); return; } const formData = new FormData(); formData.append('file', file); uploadBtn.disabled = true; uploadBtn.textContent = 'Processing...'; documentContent.innerHTML = 'Processing document...'; fetch('/Home/UploadAndProcess', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { documentContent.innerHTML = data.content; } else { documentContent.innerHTML = `<p>Error: ${data.message}</p>`; } }) .catch(error => { console.error('Error:', error); documentContent.innerHTML = '<p>An error occurred while processing the document.</p>'; }) .finally(() => { uploadBtn.disabled = false; uploadBtn.textContent = 'Upload and Process'; }); }); uploadBtn.addEventListener('click', () => { const file = fileInput.files[0]; if (!file) { alert('Please select a file first.'); return; } const formData = new FormData(); formData.append('file', file); uploadBtn.disabled = true; uploadBtn.textContent = 'Processing...'; documentContent.innerHTML = 'Processing document...'; fetch('/Home/UploadAndProcess', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { documentContent.innerHTML = data.content; } else { documentContent.innerHTML = `<p>Error: ${data.message}</p>`; } }) .catch(error => { console.error('Error:', error); documentContent.innerHTML = '<p>An error occurred while processing the document.</p>'; }) .finally(() => { uploadBtn.disabled = false; uploadBtn.textContent = 'Upload and Process'; }); }); JAVASCRIPT 이 JavaScript 코드는 파일 업로드 프로세스를 처리하고, 파일을 서버로 전송해 처리하게 하며, 처리된 콘텐츠 또는 오류 메시지로 UI를 업데이트합니다. 3.4 사용자 인터페이스 스타일링 앱은 사용자 친화적이고 매력적인 인터페이스를 생성하기 위해 맞춤 CSS를 사용합니다. <style> body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f7f7f7; color: #333; } .container { max-width: 800px; margin: 0 auto; padding: 2rem; padding-top: 0.5rem; } h1 { font-weight: 300; color: #2c3e50; text-align: center; margin-bottom: 1rem; } .lead { text-align: center; color: #7f8c8d; margin-bottom: 2rem; } .upload-area { background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); padding: 2rem; text-align: center; margin-bottom: 2rem; transition: all 0.3s ease; } .upload-area:hover { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); } .file-icon { width: 64px; height: 64px; margin-bottom: 1rem; color: #3498db; } .choose-file { background-color: #ecf0f1; color: #2c3e50; border: none; padding: 0.5rem 1rem; border-radius: 4px; cursor: pointer; transition: background-color 0.3s ease; } .choose-file:hover { background-color: #d5dbdb; } .file-info { font-size: 0.9em; color: #95a5a6; margin-top: 0.5rem; } .upload-button { background-color: #3498db; color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 4px; cursor: pointer; transition: background-color 0.3s ease; margin-top: 1rem; } .upload-button:hover { background-color: #2980b9; } .content-wrapper { background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); padding: 1rem; margin-top: 2rem; } .content-area { max-height: 300px; overflow-y: auto; padding: 1rem; background-color: #f9f9f9; border-radius: 4px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; font-size: 14px; line-height: 1.6; } .content-area::-webkit-scrollbar { width: 8px; } .content-area::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; } .content-area::-webkit-scrollbar-thumb { background: #bdc3c7; border-radius: 4px; } .content-area::-webkit-scrollbar-thumb:hover { background: #95a5a6; } .document-content p { margin: 0 0 10px 0; } </style> 이 CSS는 가벼운 색상 스킴으로 깔끔하고 현대적인 모습을 만듭니다. 업로드 영역은 미묘한 그림자 효과가 있는 흰색 배경을 특징으로 하고, 내용 영역은 스크롤 가능한 디자인으로 연한 회색 배경을 가지고 있습니다. border-radius 및 box-shadow 속성을 사용하여 인터페이스 요소에 깊이감과 시각적 흥미를 더합니다. 4. 워드 문서 내보내기 워드 문서 프로세서를 계속 개선하면서 문서를 내보낼 수 있는 기능을 추가해 봅시다. 이 기능을 통해 사용자는 응용 프로그램에서 새 워드 문서를 생성할 수 있습니다. 4.1 사용자 인터페이스 업데이트 먼저 내비게이션 바에 '내보내기' 옵션을 추가합니다. Views/Shared 폴더의 _Layout.cshtml 파일을 열고 요소를 찾습니다. 내보내기 기능을 위한 새 목록 항목을 추가해 봅시다: <li class="nav-item"> <a class="nav-link" id="exportLink" href="#" onclick="exportDocument(); return false;"><i class="fas fa-file-export"></i> Export</a> </li> <li class="nav-item"> <a class="nav-link" id="exportLink" href="#" onclick="exportDocument(); return false;"><i class="fas fa-file-export"></i> Export</a> </li> HTML 아이콘을 위해 Font Awesome을 사용 중이므로 섹션에 CSS 링크가 있는지 확인하십시오. 이 코드는 내비게이션 바에 '내보내기' 링크를 추가합니다. 아이콘을 위해 Font Awesome을 사용하고 클릭 시 exportDocument() 함수를 호출합니다. href="#"와 리턴 false는 기본 링크 동작을 방지합니다. 4.2 클라이언트 측 내보내기 로직 구현 이제 내보내기 프로세스를 처리할 JavaScript 함수를 추가해 봅시다. 우리의 _Layout.cshtml 파일의 맨 아래, 닫히는 태그 직전에 다음 스크립트를 추가합니다: <script> function exportDocument() { $.ajax({ url: '/Home/ExportWordDocument', type: 'POST', success: function (response) { if (response.success) { var fileName = prompt("Enter a name for the document (without extension):", "ExportedDocument"); if (fileName === null) { return; } fileName = (fileName.trim() || "ExportedDocument").replace(/\.[^/.]+$/, "") + ".docx"; var a = document.createElement('a'); a.style.display = 'none'; a.href = '/Home/DownloadFile?tempFilePath=' + encodeURIComponent(response.tempFilePath) + '&userFileName=' + encodeURIComponent(fileName); document.body.appendChild(a); a.click(); document.body.removeChild(a); } else { alert('Failed to export document: ' + response.message); } }, error: function () { alert('An error occurred while exporting the document.'); } }); } </script> <script> function exportDocument() { $.ajax({ url: '/Home/ExportWordDocument', type: 'POST', success: function (response) { if (response.success) { var fileName = prompt("Enter a name for the document (without extension):", "ExportedDocument"); if (fileName === null) { return; } fileName = (fileName.trim() || "ExportedDocument").replace(/\.[^/.]+$/, "") + ".docx"; var a = document.createElement('a'); a.style.display = 'none'; a.href = '/Home/DownloadFile?tempFilePath=' + encodeURIComponent(response.tempFilePath) + '&userFileName=' + encodeURIComponent(fileName); document.body.appendChild(a); a.click(); document.body.removeChild(a); } else { alert('Failed to export document: ' + response.message); } }, error: function () { alert('An error occurred while exporting the document.'); } }); } </script> HTML 이 JavaScript 함수는 서버에 워드 문서를 생성하도록 AJAX POST 요청을 보냅니다. 성공 시, 사용자에게 파일 이름을 묻고 파일을 다운로드할 임시 링크가 생성됩니다. 링크는 자동으로 클릭되고 DOM에서 제거됩니다. 어느 단계에서나 오류가 발생하면 사용자에게 경고가 표시됩니다. 4.3 서버 측 내보내기 기능 추가 이제 서버 측 로직을 구현해 봅시다. Controllers 폴더의 HomeController.cs 파일을 엽니다. 내보내기 프로세스를 처리할 두 가지 새로운 메서드를 추가합니다. 먼저, 워드 문서를 생성하는 메서드를 추가해 봅시다: [HttpPost] public IActionResult ExportWordDocument() { try { WordDocument doc = new WordDocument(); doc.AddText("Test Word"); string tempFileName = $"TempDoc_{Guid.NewGuid()}.docx"; string tempFilePath = Path.Combine(_environment.WebRootPath, "TempFiles", tempFileName); Directory.CreateDirectory(Path.GetDirectoryName(tempFilePath)); doc.SaveAs(tempFilePath); return Json(new { success = true, tempFilePath = $"/TempFiles/{tempFileName}" }); } catch (Exception ex) { _logger.LogError(ex, "Error exporting Word document"); return Json(new { success = false, message = "An error occurred while exporting the document." }); } } [HttpPost] public IActionResult ExportWordDocument() { try { WordDocument doc = new WordDocument(); doc.AddText("Test Word"); string tempFileName = $"TempDoc_{Guid.NewGuid()}.docx"; string tempFilePath = Path.Combine(_environment.WebRootPath, "TempFiles", tempFileName); Directory.CreateDirectory(Path.GetDirectoryName(tempFilePath)); doc.SaveAs(tempFilePath); return Json(new { success = true, tempFilePath = $"/TempFiles/{tempFileName}" }); } catch (Exception ex) { _logger.LogError(ex, "Error exporting Word document"); return Json(new { success = false, message = "An error occurred while exporting the document." }); } } $vbLabelText $csharpLabel 이 메서드는 IronWord 라이브러리를 사용하여 새 워드 문서를 만들고 샘플 텍스트를 추가한 후 고유한 이름으로 임시 파일에 저장합니다. 성공 상태와 임시 파일 경로를 포함한 JSON 객체를 반환합니다. 오류 발생 시 예외를 기록하고 실패 메시지를 반환합니다. 그 다음, 파일 다운로드를 처리하는 메서드를 추가해 봅시다: [HttpGet] public IActionResult DownloadFile(string tempFilePath, string userFileName) { try { string fullPath = Path.Combine(_environment.WebRootPath, tempFilePath.TrimStart('/')); if (!System.IO.File.Exists(fullPath)) { return NotFound(); } byte[] fileBytes = System.IO.File.ReadAllBytes(fullPath); System.IO.File.Delete(fullPath); string fileName = !string.IsNullOrEmpty(userFileName) ? userFileName : "ExportedDocument.docx"; return File(fileBytes, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fileName); } catch (Exception ex) { _logger.LogError(ex, "Error downloading file"); return BadRequest("An error occurred while downloading the file."); } } [HttpGet] public IActionResult DownloadFile(string tempFilePath, string userFileName) { try { string fullPath = Path.Combine(_environment.WebRootPath, tempFilePath.TrimStart('/')); if (!System.IO.File.Exists(fullPath)) { return NotFound(); } byte[] fileBytes = System.IO.File.ReadAllBytes(fullPath); System.IO.File.Delete(fullPath); string fileName = !string.IsNullOrEmpty(userFileName) ? userFileName : "ExportedDocument.docx"; return File(fileBytes, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", fileName); } catch (Exception ex) { _logger.LogError(ex, "Error downloading file"); return BadRequest("An error occurred while downloading the file."); } } $vbLabelText $csharpLabel 이 메서드는 ExportWordDocument에서 생성된 임시 파일을 가져와 내용을 바이트 배열로 읽은 다음 임시 파일을 삭제합니다. 제공된 사용자 파일 이름 또는 기본 이름을 사용합니다. 그 후 메서드는 파일 내용을 다운로드 가능한 워드 문서로 반환합니다. 파일을 찾을 수 없거나 오류가 발생하면 적절한 HTTP 응답이 반환됩니다. 4.4 응용 프로그램의 시각 디자인 향상 워드 문서 프로세서의 전반적인 외관과 느낌을 개선하기 위해 _Layout.cshtml 파일에 사용자 지정 CSS를 직접 추가했습니다. 구현한 스타일을 살펴보겠습니다: <style> :root { --primary-color: #3498db; --text-color: #333; --bg-color: #f8f9fa; --nav-bg: #fff; --nav-text: #2c3e50; --nav-hover: #3498db; } body { font-family: 'Segoe UI', sans-serif; background-color: var(--bg-color); color: var(--text-color); line-height: 1.6; } .navbar { background-color: var(--nav-bg); } .navbar-brand { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); margin-right: 2rem; } .navbar-nav { margin-left: auto; } .navbar-nav .nav-item { margin-left: 1rem; } .navbar-nav .nav-link { color: var(--nav-text); font-weight: 500; transition: all 0.3s ease; padding: 0.5rem 1rem; border-radius: 4px; } .navbar-nav .nav-link:hover, .navbar-nav .nav-link.active { color: var(--primary-color); background-color: rgba(52, 152, 219, 0.1); } .navbar-nav .nav-link i { margin-right: 0.5rem; font-size: 1.1em; } .centered-container { max-width: 800px; margin: 0 auto; padding: 2rem; } .footer { background-color: var(--nav-bg); border-top: 1px solid #ecf0f1; font-size: 0.9em; color: var(--nav-text); } .footer a { color: var(--primary-color); text-decoration: none; transition: color 0.3s ease; } .footer a:hover { color: var(--nav-hover); } @media (max-width: 576px) { .navbar-nav { margin-left: 0; margin-top: 1rem; } .navbar-nav .nav-item { margin-left: 0; margin-bottom: 0.5rem; } } </style> 이 CSS 블록은 애플리케이션의 색상 스킴과 레이아웃을 정의합니다. CSS 변수(사용자 속성)를 사용하여 앱 전체의 일관된 색상 팔레트를 만듭니다. 스타일은 본문, 내비게이션 바, 푸터를 포함한 다양한 요소를 대상으로 하여 일관된 디자인을 구현합니다. 내비게이션 바를 깨끗하고 현대적인 모양으로 설정했으며, 호버 효과와 아이콘 통합을 특징으로 합니다. 응용 프로그램은 현재 워드 문서에 중점을 두고 있지만, IronPDF를 사용하여 PDF 문서 지원을 추가하고 기능을 확장하여 다양한 파일 형식을 다룰 수 있습니다. 시스템은 사용자가 현재 워드 형식 선택 옵션 외에 PDF 파일로 문서를 내보낼 수 있도록 확장될 수 있습니다. 5. 응용 프로그램 실행 우리의 WordDocumentProcessor 애플리케이션을 실행해 봅시다. 이미지에서 볼 수 있는 것처럼 애플리케이션이 브라우저에서 성공적으로 로드되었습니다. 인터페이스는 상단에 '홈'과 '내보내기' 옵션이 표시된 내비게이션 바가 있는 깨끗하고 사용자 친화적인 모습입니다. 주요 콘텐츠 영역에는 제목 '워드 문서 프로세서'와 짧은 설명: '워드 문서를 쉽게 업로드하고 처리하십시오.'가 표시됩니다. 이제 문서를 가져와 봅시다. 이미지에서 볼 수 있듯이 'Honey research synopsis.docx'라는 파일이 선택되었습니다. 파일 이름이 '파일 선택' 버튼을 대신하여 업로드 영역에 표시됩니다. 이 문서를 업로드하고 처리할 준비가 되었습니다. '업로드 및 처리'를 클릭한 후, 애플리케이션은 문서를 처리하고 그 내용을 표시합니다. '문서 내용' 섹션에는 업로드된 문서의 시작 부분이 표시됩니다. 도시 지역에서의 양봉 기술과 꿀 생산 품질"이라는 제목이 보이고 그 다음에 요약이 나옵니다. 이것은 애플리케이션이 Word 문서의 내용을 성공적으로 읽고 표시했음을 보여줍니다. 마지막으로 내보내기 기능을 테스트해 봅시다. 이미지에서는 내비게이션 바에서 '내보내기' 버튼을 클릭할 때 나타나는 프롬프트를 볼 수 있습니다. 프롬프트는 "문서의 이름을 입력하세요 (확장자 제외)"라고 묻습니다. 기본 이름 "ExportedDocument"가 미리 입력되어 있지만, 원한다면 이를 변경할 수 있습니다. 이 프롬프트를 통해 다운로드하기 전에 내보낸 문서의 이름을 사용자 지정할 수 있습니다. '확인'을 클릭하면 애플리케이션은 지정된 이름으로 새로운 Word 문서를 생성하고 다운로드 과정을 시작합니다. 이 내보낸 문서는 우리가 애플리케이션 내에서 처리한 내용이나 수정 사항을 포함합니다. 이 과정을 통해 애플리케이션이 의도한 대로 작동하고 있음을 확인할 수 있습니다. 이 애플리케이션을 사용하여 Word 문서를 가져오고 문서를 만들고 내보내기를 쉽게 할 수 있습니다. 사용자 인터페이스는 직관적이고 반응이 빠릅니다. 결론 결론적으로, 우리의 WordDocumentProcessor 애플리케이션은 ASP.NET Core 웹 애플리케이션에 Word 문서 처리를 통합함으로써 그 강력함과 유연성을 성공적으로 보여줍니다. IronWord 라이브러리를 활용하여 Word 문서를 손쉽게 가져오고 표시하고 내보내는 강력한 솔루션을 만들었습니다. 이 애플리케이션은 더 복잡한 문서 관리 시스템이나 보고서 생성기를 위한 견고한 기반을 제공합니다. IronWord의 기능을 탐구하고자 하는 개발자를 위해, 라이브러리는 무료 체험판을 제공합니다. 체험판 이후 라이선스는 $799에서 시작하여 웹 애플리케이션에서 고급 Word 문서 처리 기능을 필요로 하는 기업에게 비용 효율적인 솔루션을 제공합니다. 자주 묻는 질문 ASP.NET Core 애플리케이션에서 Word 문서를 가져오려면 어떻게 해야 하나요? IronWord를 사용하면 ASP.NET Core 애플리케이션에 Word 문서를 가져올 수 있습니다. UI에 업로드 영역을 제공한 다음, IronWord 라이브러리를 사용하여 문서를 처리하고 내용을 추출하여 애플리케이션에 표시할 수 있습니다. ASP.NET Core 에서 Word 문서를 내보내는 단계는 무엇인가요? ASP.NET Core 에서 Word 문서를 내보내려면 IronWord 사용하여 새 문서를 만들고 사용자가 다운로드할 수 있는 기능을 제공하세요. 파일 이름을 지정하고 IronWord의 메서드를 사용하여 Word 파일에 내용을 기록할 수 있습니다. ASP.NET Core 애플리케이션에서 Word 문서를 PDF로 변환할 수 있나요? 네, ASP.NET Core 애플리케이션에서 IronWord 사용하여 Word 문서를 PDF로 변환할 수 있습니다. IronWord Word 문서를 PDF 형식으로 쉽게 변환하여 공유 및 접근성을 높일 수 있는 다양한 메서드를 제공합니다. 해당 애플리케이션은 Word 문서를 가져올 때 어떤 파일 형식을 지원합니까? 이 애플리케이션은 IronWord 라이브러리를 사용하여 .DOC 및 .DOCX 파일 형식을 가져오기를 지원하므로 ASP.NET Core 애플리케이션 내에서 이러한 문서를 처리하고 표시할 수 있습니다. 문서 처리 애플리케이션의 성능 향상에 JavaScript 어떻게 사용됩니까? JavaScript 는 파일 업로드를 처리하고, IronWord 사용한 문서 처리를 위해 서버에 AJAX 요청을 보내고, 처리된 콘텐츠 또는 오류 메시지로 사용자 인터페이스를 업데이트하여 원활한 사용자 경험을 보장하는 데 사용됩니다. ASP.NET Core 로 워드 프로세싱 앱을 개발하기 위한 필수 조건은 무엇입니까? ASP.NET Core 로 워드 프로세싱 앱을 개발하려면 C# 및 ASP.NET Core 에 대한 기본 지식, Visual Studio 2019 이상 또는 C# 확장 프로그램이 설치된 Visual Studio Code, 그리고 .NET Core SDK 3.1 이상이 필요합니다. 문서 처리 효율을 높이기 위해 사용자 인터페이스를 어떻게 설계해야 할까요? 사용자 인터페이스는 Word 문서를 선택할 수 있는 업로드 영역과 처리된 콘텐츠를 표시하는 콘텐츠 표시 영역으로 디자인할 수 있습니다. 사용자 정의 CSS를 사용하여 매력적이고 사용자 친화적인 디자인을 구현할 수 있습니다. 워드 프로세싱 기능을 웹 애플리케이션에 통합할 수 있는 잠재적인 활용 사례는 무엇일까요? 잠재적 활용 사례로는 문서 관리 시스템 및 보고서 생성기가 있으며, IronWord 사용하여 워드 프로세싱 기능을 통합하면 웹 애플리케이션 내에서 문서 처리, 편집 및 변환 프로세스를 간소화할 수 있습니다. 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다. 커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다. 관련 기사 업데이트됨 3월 1, 2026 IronWord 사용하여 C#에서 입력 가능한 양식 템플릿을 만드는 방법 IronWord 사용하여 C#으로 입력 가능한 양식 템플릿을 만드는 방법을 알아보세요. 더 읽어보기 업데이트됨 10월 11, 2025 VS 2022에서 프로그램으로 새 Word 문서 만들기(튜토리얼) 오늘 튜토리얼에서는 IronWord 사용하여 Microsoft Word 문서를 프로그래밍 방식으로 생성하는 방법을 간략하게 설명하고 몇 가지 예제를 제공하겠습니다. 더 읽어보기 업데이트됨 1월 18, 2026 C#을 사용하여 Word에서 텍스트를 정렬하는 방법 IronWord NuGet 패키지를 자세히 살펴보고 이 패키지를 사용하여 텍스트나 단락을 정렬하는 방법을 알아보겠습니다. 더 읽어보기 IronWord 사용하여 C#에서 입력 가능한 양식 템플릿을 만드는 방법VS 2022에서 프로그램으로 ...
업데이트됨 3월 1, 2026 IronWord 사용하여 C#에서 입력 가능한 양식 템플릿을 만드는 방법 IronWord 사용하여 C#으로 입력 가능한 양식 템플릿을 만드는 방법을 알아보세요. 더 읽어보기
업데이트됨 10월 11, 2025 VS 2022에서 프로그램으로 새 Word 문서 만들기(튜토리얼) 오늘 튜토리얼에서는 IronWord 사용하여 Microsoft Word 문서를 프로그래밍 방식으로 생성하는 방법을 간략하게 설명하고 몇 가지 예제를 제공하겠습니다. 더 읽어보기
업데이트됨 1월 18, 2026 C#을 사용하여 Word에서 텍스트를 정렬하는 방법 IronWord NuGet 패키지를 자세히 살펴보고 이 패키지를 사용하여 텍스트나 단락을 정렬하는 방법을 알아보겠습니다. 더 읽어보기