IronWord 방법 텍스트에 스타일 추가 How to Add Style to Text in DOCX with C# 아흐마드 소하일 업데이트됨:3월 8, 2026 다운로드 IronWord NuGet 다운로드 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 This article was translated from English: Does it need improvement? Translated View the article in English IronWord의 TextStyle 클래스는 .NET 개발자가 워드 문서에 프로그램 방식으로 전문적인 텍스트 서식을 적용할 수 있게 합니다. 여기에는 폰트, 색상, 굵게, 기울임, 밑줄 등을 포함합니다. 보고서 작성, 템플릿 제작 또는 문서 자동 생성 등 어떤 작업을 하든 IronWord Microsoft Word의 서식 옵션을 그대로 재현하는 포괄적인 스타일링 도구를 제공합니다. 빠른 시작: C#을 사용하여 DOCX 파일의 텍스트 스타일 지정 NuGet 패키지 관리자를 사용하여 https://www.nuget.org/packages/IronWord 설치하기 PM > Install-Package IronWord 다음 코드 조각을 복사하여 실행하세요. // Quick example using IronWord; using IronWord.Models; // Initialize a new Word document WordDocument doc = new WordDocument(); // Create a Run with styled text Run textRun = new Run(new TextContent("Styled text")); // Apply styling properties to the Run textRun.Style = new TextStyle() { IsBold = true, Color = Color.Red, FontSize = 16, TextFont = new Font() { FontFamily = "Arial" } }; // Create paragraph and add the styled Run Paragraph paragraph = new Paragraph(); paragraph.AddChild(textRun); // Add paragraph to document and save doc.AddParagraph(paragraph); doc.SaveAs("styled.docx"); 실제 운영 환경에서 테스트할 수 있도록 배포하세요. 무료 체험판으로 오늘 프로젝트에서 IronWord 사용 시작하기 Free 30 Day Trial ### 최소 워크플로우(5단계) IronWord C# 라이브러리 설치 `TextContent` 포함하는 `Run` 객체를 생성합니다. `FontSize` , `IsBold` , `Color` 과 같은 속성을 사용하여 `Run` 에 `TextStyle` 적용합니다. `AddChild` 사용하여 스타일이 적용된 `Run` `Paragraph` 에 추가합니다. 스타일이 적용된 상태로 문서를 저장하세요 DOCX 파일에 텍스트 스타일을 추가하는 방법은 무엇인가요? IronWord에서 텍스트 스타일을 적용하려면 Run 래퍼 패턴을 사용해야 합니다. WordDocument 객체를 생성한 후, 텍스트를 포함한 Run 객체를 생성합니다. 속성 IsBold, Color, 또는 FontSize 등을 사용하여 TextStyle을 TextContent가 아님) 에 적용합니다. 스타일이 적용된 후, Run을 Paragraph에 AddChild을 사용하여 추가하고, 문서에 문단을 삽입한 후 결과를 저장합니다. 이 접근 방식은 일관된 스타일링이 요구되는 자동화된 문서 생성 시나리오에서 텍스트 서식에 대한 프로그래밍 제어를 제공합니다. IronWord의 문서 계층 구조는 다음과 같은 구조를 따릅니다: 문서 → 문서 섹션 → 단락 → 실행 → 텍스트 콘텐츠. 스타일은 텍스트 콘텐츠가 아니라 실행(Run) 수준에서 적용됩니다. :path=/static-assets/word/content-code-examples/how-to/add-style-text-simple.cs using IronWord; using IronWord.Models; using IronWord.Models.Enums; // Load docx WordDocument doc = new WordDocument("sample.docx"); // Configure text Run textRun = new Run(new TextContent("Add text using IronWord")); // Configure text style settings textRun.Style = new TextStyle() { FontSize = 24, // Text Size is 24 TextFont = new Font() { FontFamily = "Calibri" // Text Font is "Calibri" }, Color = Color.Red, // Set text color to red IsBold = true, // Make text bold IsItalic = true, // Make text italic Underline = new Underline(), // Have an underline Strike = StrikeValue.DoubleStrike, // No strike-through }; Paragraph paragraph = new Paragraph(); // Add text to paragraph paragraph.AddChild(textRun); // Add paragraph to document doc.AddParagraph(paragraph); // Save document doc.SaveAs("add-text-style.docx"); $vbLabelText $csharpLabel 이것은 어떤 결과를 생성할까요? TextStyle 클래스는 폰트 속성, 텍스트 색상, 굵게, 기울임, 밑줄을 포함한 필수 형식 옵션을 제공합니다. FontSize를 TextStyle 레벨에서 구성하며(Font 내부가 아님), FontFamily는 TextFont 속성 내에서 설정됩니다. Run 객체는 TextContent를 감싸고 스타일을 보유하며, IronWord의 문서 계층 패턴을 따릅니다. 이 예제는 여러 스타일 속성이 결합되어 Run에 적용될 때 어떻게 풍부한 형식의 텍스트가 생성되는지를 보여줍니다. 어떤 특정 스타일을 추가할 수 있나요? 글자 색상을 어떻게 변경하나요? TextStyle의 Color 속성은 IronWord.Models.Color의 미리 정의된 색상 또는 사용자 정의 헥스 값을 사용하여 텍스트 색상을 설정합니다. 이는 특정 콘텐츠를 강조하거나 브랜드 색상과 일치합니다. IronWord 빨강, 파랑, 녹색, 올리브색, 네이비색, 마룬색을 포함한 다양한 색상을 지원합니다. :path=/static-assets/word/content-code-examples/how-to/add-style-text-add-text.cs using IronWord; using IronWord.Models; // Create document WordDocument doc = new WordDocument(); // Add colored text Run textRun = new Run(new TextContent("This text is olive-colored!")); textRun.Style = new TextStyle() { Color = IronWord.Models.Color.Olive // defining text to be colored olive }; Paragraph paragraph = new Paragraph(); paragraph.AddChild(textRun); doc.AddParagraph(paragraph); // Save document doc.SaveAs("colored-text.docx"); $vbLabelText $csharpLabel 색깔 있는 텍스트는 어떤 모습일까요? 글꼴 종류와 크기는 어떻게 설정하나요? TextFont 속성을 사용하여 텍스트 외형을 맞춤 설정합니다. 설치된 폰트 이름(예: "Arial", "Times New Roman") 으로 FontFamily을 설정하고, 포인트 단위로 FontSize을 설정합니다. 이를 통해 시각적 계층 구조가 확립되고 다양한 기기 및 플랫폼에서 가독성이 보장됩니다. :path=/static-assets/word/content-code-examples/how-to/add-style-text-add-font.cs using IronWord; using IronWord.Models; // Create document WordDocument doc = new WordDocument(); // Add text with custom font family and size Run textRun = new Run(new TextContent("This text uses Arial at 24pt!")); textRun.Style = new TextStyle() { FontSize = 24, // Set font size in points TextFont = new IronWord.Models.Font() { FontFamily = "Arial" // Set font family } }; Paragraph paragraph = new Paragraph(); paragraph.AddChild(textRun); doc.AddParagraph(paragraph); // Save document doc.SaveAs("font-styled-text.docx"); $vbLabelText $csharpLabel 사용자 지정 글꼴 스타일링은 어떤 모습일까요? 텍스트를 굵게 표시하려면 어떻게 해야 하나요? IsBold 속성을 true로 설정하여 텍스트를 굵게 만듭니다. 굵은 글씨는 제목, 강조 또는 중요한 정보를 부각하는 데 일반적으로 사용됩니다. 다른 스타일링 속성과 함께 사용하면 굵은 텍스트는 시각적 계층 구조를 만들어 가독성을 향상시킵니다. :path=/static-assets/word/content-code-examples/how-to/add-style-text-add-bold.cs using IronWord; using IronWord.Models; // Create document WordDocument doc = new WordDocument(); // Add bold text Run textRun = new Run(new TextContent("this is bold!")); textRun.Style = new TextStyle() { IsBold = true // Make text bold }; Paragraph paragraph = new Paragraph(); paragraph.AddChild(textRun); doc.AddParagraph(paragraph); // Save document doc.SaveAs("bold-text.docx"); $vbLabelText $csharpLabel 굵은 글씨는 어떻게 생겼나요? 텍스트를 이탤릭체로 만드는 방법은 무엇인가요? IsItalic 속성을 true로 설정하여 기울임체를 적용합니다. 이탤릭체는 일반적으로 강조, 제목, 외국어 또는 전문 용어에 사용됩니다. 이 미묘한 서식은 굵은 글씨체처럼 시각적 부담을 주지 않으면서도 텍스트 요소를 구분합니다. :path=/static-assets/word/content-code-examples/how-to/add-style-text-add-italic.cs using IronWord; using IronWord.Models; // Create document WordDocument doc = new WordDocument(); // Add italic text Run textRun = new Run(new TextContent("this is italic.")); textRun.Style = new TextStyle() { IsItalic = true // Make text italic }; Paragraph paragraph = new Paragraph(); paragraph.AddChild(textRun); doc.AddParagraph(paragraph); // Save document doc.SaveAs("italic-text.docx"); $vbLabelText $csharpLabel 기울임체 텍스트는 어떻게 생겼나요? 사용 가능한 스타일링 속성은 무엇인가요? IronWord Microsoft Word의 서식 옵션과 유사한 포괄적인 스타일링 속성을 제공합니다. 이러한 속성들이 결합되어 전문적인 문서 기준을 충족하는 복잡한 텍스트 서식을 만들어냅니다. 스타일링 방법 설명 예 `TextFont` **`Font` 객체를** 사용하여 글꼴 패밀리를 설정함으로써 텍스트 모양을 사용자 지정할 수 있습니다. 참고: `FontSize` `Font` 내부가 아닌 `TextStyle` 수준에서 설정됩니다. `textRun.Style = new TextStyle() { FontSize = 24, TextFont = new Font() { FontFamily = "Calibri" } };` `Color` **`IronWord.Models.Color`** 의 미리 정의된 색상 또는 사용자 지정 16진수 값을 사용하여 텍스트 색상을 설정합니다. `textRun.Style.Color = IronWord.Models.Color.Red;` `IsBold` `true` 로 설정하면 텍스트가 굵게 표시됩니다. 일반적으로 제목이나 강조에 사용됩니다. `textRun.Style.IsBold = true;` `IsItalic` `true` 로 설정하면 텍스트에 이탤릭체 스타일이 적용되며, 일반적으로 강조 또는 제목에 사용됩니다. `textRun.Style.IsItalic = true;` `Underline` 다양한 밑줄 스타일을 가진 **`Underline` 객체를** 사용하여 텍스트에 밑줄을 추가합니다. `textRun.Style.Underline = new Underline();` `Strike` **`StrikeValue` 열거형** (Strike 또는 DoubleStrike)을 사용하여 텍스트에 취소선을 적용합니다. `textRun.Style.Strike = StrikeValue.Strike;` `Caps` 텍스트에 대문자화 효과를 적용하여 모든 문자를 대문자로 표시합니다. `textRun.Style.Caps = true;` `CharacterScale` 문자의 너비를 정상 크기의 백분율로 조정합니다. `textRun.Style.CharacterScale = 150;` `Emboss` 텍스트에 양각 효과를 적용하여 입체적인 모양을 만듭니다. `textRun.Style.Emboss = true;` `Emphasis` **`EmphasisMarkValues` 열거형** 값을 사용하여 스타일이 적용된 텍스트에 강조 표시를 추가합니다. `textRun.Style.Emphasis = EmphasisMarkValues.Dot;` `LineSpacing` **`LineSpacing` 객체를** 사용하여 텍스트 줄 사이의 간격을 제어하여 가독성을 향상시킵니다. `textRun.Style.LineSpacing = new LineSpacing() { Value = 1.5 };` `Outline` 글자 테두리만 표시하여 윤곽선 효과를 적용한 텍스트 렌더링을 제공합니다. `textRun.Style.Outline = true;` `Shading` **`Shading` 객체를** 사용하여 텍스트에 배경색 또는 음영을 적용합니다. `textRun.Style.Shading = new Shading() { Color = Color.Yellow };` `SmallCaps` 대소문자를 구분하지 않고 소문자를 작은 대문자로 변환합니다. `textRun.Style.SmallCaps = true;` `VerticalPosition` 텍스트의 세로 위치를 기준선에 맞춰 조정합니다(점 단위). `textRun.Style.VerticalPosition = 5.0;` `VerticalTextAlignment` **`VerticalPositionValues` 열거형을** 사용하여 컨테이너 내에서 텍스트를 세로로 배치합니다. `textRun.Style.VerticalTextAlignment = VerticalPositionValues.Superscript;` 여러 스타일의 조합 IronWord의 텍스트 스타일링 기능은 여러 속성을 조합하여 복잡한 서식을 구현하는 데서 비롯됩니다. 다음은 다양한 스타일링 속성을 조합하여 전문적인 스타일의 텍스트를 만드는 방법을 보여주는 예입니다. using IronWord; using IronWord.Models; // Create a new document WordDocument doc = new WordDocument(); // Create richly formatted header text using Run Run headerRun = new Run(new TextContent("Professional Document Header")); headerRun.Style = new TextStyle() { FontSize = 28, TextFont = new Font() { FontFamily = "Georgia" }, Color = Color.DarkBlue, IsBold = true, SmallCaps = true, Underline = new Underline(), CharacterScale = 110, // Slightly expand character width Shading = new Shading() { Color = Color.LightGray // Light background } }; // Add header to document using AddChild for styled Run Paragraph headerParagraph = new Paragraph(); headerParagraph.AddChild(headerRun); doc.AddParagraph(headerParagraph); // Create body text with different styling Run bodyRun = new Run(new TextContent("This is professionally formatted body text with custom styling.")); bodyRun.Style = new TextStyle() { FontSize = 11, TextFont = new Font() { FontFamily = "Calibri" }, Color = Color.Black, LineSpacing = new LineSpacing() { Value = 1.15 } // Slightly increased line spacing }; Paragraph bodyParagraph = new Paragraph(); bodyParagraph.AddChild(bodyRun); doc.AddParagraph(bodyParagraph); // Save the document doc.SaveAs("professional-document.docx"); using IronWord; using IronWord.Models; // Create a new document WordDocument doc = new WordDocument(); // Create richly formatted header text using Run Run headerRun = new Run(new TextContent("Professional Document Header")); headerRun.Style = new TextStyle() { FontSize = 28, TextFont = new Font() { FontFamily = "Georgia" }, Color = Color.DarkBlue, IsBold = true, SmallCaps = true, Underline = new Underline(), CharacterScale = 110, // Slightly expand character width Shading = new Shading() { Color = Color.LightGray // Light background } }; // Add header to document using AddChild for styled Run Paragraph headerParagraph = new Paragraph(); headerParagraph.AddChild(headerRun); doc.AddParagraph(headerParagraph); // Create body text with different styling Run bodyRun = new Run(new TextContent("This is professionally formatted body text with custom styling.")); bodyRun.Style = new TextStyle() { FontSize = 11, TextFont = new Font() { FontFamily = "Calibri" }, Color = Color.Black, LineSpacing = new LineSpacing() { Value = 1.15 } // Slightly increased line spacing }; Paragraph bodyParagraph = new Paragraph(); bodyParagraph.AddChild(bodyRun); doc.AddParagraph(bodyParagraph); // Save the document doc.SaveAs("professional-document.docx"); $vbLabelText $csharpLabel 이러한 포괄적인 스타일링 접근 방식은 애플리케이션 문서 생성 과정 전반에 걸쳐 일관된 브랜딩과 전문적인 외관을 유지하는 문서를 생성합니다. 자주 묻는 질문 C#에서 Word 문서에 텍스트 서식을 프로그래밍 방식으로 적용하려면 어떻게 하나요? IronWord의 TextStyle 클래스는 글꼴, 색상, 굵게, 기울임꼴 및 밑줄을 포함한 전문적인 텍스트 서식을 적용할 수 있게 해줍니다. 텍스트로 TextContent 객체를 생성하고 원하는 속성으로 TextStyle을 적용한 다음, 단락에 추가하여 문서를 저장합니다. DOCX 파일에 텍스트 스타일을 지정하는 기본 단계는 무엇인가요? IronWord로 텍스트 스타일을 지정하려면: 1) NuGet을 통해 IronWord를 설치, 2) WordDocument 객체 생성, 3) 텍스트로 TextContent 생성, 4) 글꼴, 색상 또는 굵게 등의 TextStyle 속성 적용, 5) 텍스트를 단락에 추가하고 저장하세요. 어떤 텍스트 서식 옵션이 사용 가능한가요? IronWord의 TextStyle 클래스는 글꼴 속성(FontFamily 및 FontSize), 텍스트 색상, 굵게, 기울임꼴, 밑줄 및 취소선을 포함한 기본 포맷 옵션을 제공합니다. 이 옵션들을 결합하여 풍부하게 포맷된 텍스트를 만들 수 있습니다. 텍스트의 글꼴 종류와 크기를 어떻게 변경하나요? TextStyle의 TextFont 속성을 사용하여 글꼴 종류와 크기를 지정하세요. FontFamily를 'Arial' 또는 'Times New Roman'과 같은 글꼴로 설정하고, FontSize를 16과 같이 더 큰 텍스트 크기로 설정하세요. 여러 텍스트 스타일을 동시에 적용할 수 있나요? 네, IronWord에서는 단일 TextStyle 객체에 여러 스타일 속성을 결합하여 적용할 수 있습니다. 굵게, 기울임꼴, 색상 및 글꼴 변경 등을 한 번에 적용하여 복잡한 텍스트 서식을 만들 수 있습니다. C#을 사용하여 Word 문서에서 텍스트 색상을 어떻게 변경하나요? IronWord의 TextStyle의 Color 속성을 사용하여 IronWord.Models.Color의 사전 설정 색상 또는 사용자 지정 16진수 값을 사용하여 텍스트 색상을 설정할 수 있습니다. 이 기능은 특정 콘텐츠를 강조하거나 브랜드 색상과 맞출 때 유용합니다. 아흐마드 소하일 지금 바로 엔지니어링 팀과 채팅하세요 풀스택 개발자 아흐마드는 C#, Python 및 웹 기술에 탄탄한 기반을 갖춘 풀스택 개발자입니다. 그는 확장 가능한 소프트웨어 솔루션 구축에 깊은 관심을 가지고 있으며, 실제 응용 프로그램에서 디자인과 기능이 어떻게 조화를 이루는지 탐구하는 것을 즐깁니다. Iron Software 팀에 합류하기 전, 아흐마드는 자동화 프로젝트와 API 통합 업무를 담당하며 성능 향상과 개발자 경험 개선에 주력했습니다. 그는 여가 시간에 UI/UX 아이디어를 실험하고, 오픈 소스 도구에 기여하며, 복잡한 주제를 더 쉽게 이해할 수 있도록 기술 문서를 작성하는 데 몰두하기도 합니다. 시작할 준비 되셨나요? Nuget 다운로드 35,581 | 버전: 2026.3 방금 출시되었습니다 무료 체험 시작하기 NuGet 무료 다운로드 총 다운로드 수: 35,581 라이선스 보기 아직도 스크롤하고 계신가요? 빠른 증거를 원하시나요? PM > Install-Package IronWord 샘플 실행 데이터를 워드 문서로 변환 확인. NuGet 무료 다운로드 총 다운로드 수: 35,581 라이선스 보기