스타일 텍스트 추가 IronWord 의 "텍스트 스타일 추가" 기능은 개발자가 DOCX 문서에 콘텐츠를 추가하는 동안 다양한 텍스트 스타일 옵션을 적용할 수 있도록 합니다. 글꼴 종류, 크기, 색상, 굵게, 기울임, 밑줄, 취소선과 같은 스타일 속성을 지정하는 등 텍스트의 모양을 세밀하게 제어할 수 있습니다. 개발자는 Run 객체를 생성하여 TextContent를 포함시키고, TextStyle를 Run에게 할당하여 문서 내 개별 텍스트 요소의 표현을 맞춤 설정할 수 있으며, 사용자 정의된 룩앤필을 보장할 수 있습니다. 이 기능은 보고서나 편지처럼 특정 섹션에 서로 다른 스타일이 필요한 전문적인 형식의 문서를 동적으로 생성하는 데 유용합니다. TextStyle 클래스는 이러한 속성의 쉬운 조작을 가능하게 하며, 동일한 문서 내에서 단순하거나 복잡한 스타일링을 허용합니다. 핵심 사항 스타일이 적용된 실행 화면 만들기 : A Run object is created containing TextContent with the desired text. The Style property of the Run is assigned a TextStyle object to apply formatting. 텍스트 스타일 구성 : FontSize: Set at the TextStyle level (not inside Font) to specify text size. TextFont: Contains font properties including FontFamily for font selection. Color: Specifies the text color using IronWord.Models.Color. IsBold and IsItalic: Boolean properties for bold and italic formatting. Underline: Adds underline styling to the text. Strike: Applies strikethrough formatting using StrikeValue enum. 문서에 추가하기 : Use AddChild to add the styled Run to a Paragraph. The paragraph is then added to the document with AddParagraph. 코드 설명 이 코드는 IronWord 사용하여 DOCX 문서에 텍스트를 생성하고 스타일을 지정하는 방법을 보여줍니다. It begins by initializing a new WordDocument object, representing the document to be generated. A Run object is created containing TextContent with the string "Styled text example" and a TextStyle is applied to the Run to configure the appearance of the text. The TextStyle includes settings for font size set at the TextStyle level (not inside Font), font family configured via TextFont, text color, and bold formatting. 이 설정은 최종 문서에서 텍스트가 표시되는 방식을 사용자 지정합니다. After the Run is styled, the AddChild method adds the Run object to a paragraph in the document. 이 방법은 스타일이 적용된 콘텐츠를 적절한 형식으로 워드 문서에 삽입합니다. Finally, the SaveAs method is called to export the document as "styled_document.docx". 결과적으로 삽입된 텍스트가 지정된 스타일에 따라 서식이 지정되고 모든 글꼴 및 서식 속성이 출력 파일에 유지되는 Word 문서가 생성됩니다. 문서 요소 튜토리얼을 통해 더 많은 스타일링 팁을 확인해 보세요. 관련 문서 링크 깃허브에서 보기 관련 튜토리얼 관련 사용법 가이드 클래스 문서화 IronWord DLL 다운로드 이 페이지의 문제점을 신고하세요 시작할 준비 되셨나요? Nuget 다운로드 35,581 | 버전: 2026.3 방금 출시되었습니다 무료 체험 시작하기 NuGet 무료 다운로드 총 다운로드 수: 35,581 라이선스 보기 아직도 스크롤하고 계신가요? 빠른 증거를 원하시나요? PM > Install-Package IronWord 샘플 실행 데이터를 워드 문서로 변환 확인. NuGet 무료 다운로드 총 다운로드 수: 35,581 라이선스 보기