첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
본 블로그는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 블로그 콘텐츠 향상을 위해 쓰여집니다.

728x90
반응형
728x170
using DevExpress.XtraRichEdit.API.Native;

#region 추상 넘버링 리스트 생성하기 - CreateAbstractNumberingList(document, numberingType)

/// <summary>
/// 추상 넘버링 리스트 생성하기
/// </summary>
/// <param name="document">Document 객체</param>
/// <param name="numberingType">NumberingType 객체</param>
/// <returns>AbstractNumberingList 객체</returns>
private AbstractNumberingList CreateAbstractNumberingList(Document document, NumberingType numberingType)
{
    AbstractNumberingList abstractNumberingList = document.AbstractNumberingLists.Add();

    abstractNumberingList.NumberingType = numberingType;

    return abstractNumberingList;
}

#endregion

#region 리스트 레벨 설정하기 - SetListLevel(abstractNumberingList, levelIndex, leftIndent, fontName, displayFormatString)

/// <summary>
/// 리스트 레벨 설정하기
/// </summary>
/// <param name="abstractNumberingList">AbstractNumberingList 객체</param>
/// <param name="levelIndex">레벨 인덱스</param>
/// <param name="leftIndent">왼쪽 들여쓰기</param>
/// <param name="fontName">폰트명</param>
/// <param name="displayFormatString">디스플레이 포맷 문자열</param>
private void SetListLevel(AbstractNumberingList abstractNumberingList, int levelIndex, int leftIndent, string fontName, string displayFormatString)
{
    ListLevel listLevel = abstractNumberingList.Levels[levelIndex];

    listLevel.ParagraphProperties.LeftIndent = leftIndent;
    listLevel.CharacterProperties.FontName   = fontName;
    listLevel.DisplayFormatString            = displayFormatString;
}

#endregion

#region 넘버링 리스트 생성하기 - CreateNumberingList(document, abstractNumberingListIndex)

/// <summary>
/// 넘버링 리스트 생성하기
/// </summary>
/// <param name="document">Document 객체</param>
/// <param name="abstractNumberingListIndex">추상 넘버링 리스트 인덱스</param>
/// <returns>NumberingList 객체</returns>
private NumberingList CreateNumberingList(Document document, int abstractNumberingListIndex)
{
    NumberingList numberingList = document.NumberingLists.Add(abstractNumberingListIndex);

    return numberingList;
}

#endregion

#region 넘버링 리스트 패러그래프 추가하기 - AppendNumberingListParagraph(document, listIndex, listLevel, text)

/// <summary>
/// 넘버링 리스트 패러그래프 추가하기
/// </summary>
/// <param name="document">Document 객체</param>
/// <param name="listIndex">리스트 인덱스</param>
/// <param name="listLevel">리스트 레벨</param>
/// <param name="text">텍스트</param>
private void AppendNumberingListParagraph(Document document, int listIndex, int listLevel, string text)
{
    document.AppendText(text);

    document.AppendParagraph();

    Paragraph paragraph = document.Paragraphs[document.Paragraphs.Count - 2];

    paragraph.ListIndex = listIndex;
    paragraph.ListLevel = listLevel;
}

#endregion

...

Document document = this.richEditControl.Document;

document.BeginUpdate();

AbstractNumberingList abstractNumberingList = CreateAbstractNumberingList(document, NumberingType.Bullet);

SetListLevel(abstractNumberingList, 0, 0  , "Symbol", new string('\u00B7', 1));
SetListLevel(abstractNumberingList, 1, 150, "Symbol", new string('\u006F', 1));
SetListLevel(abstractNumberingList, 2, 300, "Symbol", new string('\u00B7', 1));

int listIndex = abstractNumberingList.Index;

NumberingList numberingList = CreateNumberingList(document, listIndex);

AppendNumberingListParagraph(document, listIndex, 0, "Level 0 Paragraph 00");
AppendNumberingListParagraph(document, listIndex, 0, "Level 0 Paragraph 01");
AppendNumberingListParagraph(document, listIndex, 0, "Level 0 Paragraph 02");
AppendNumberingListParagraph(document, listIndex, 1, "Level 1 Paragraph 03");
AppendNumberingListParagraph(document, listIndex, 1, "Level 1 Paragraph 04");
AppendNumberingListParagraph(document, listIndex, 2, "Level 2 Paragraph 05");
AppendNumberingListParagraph(document, listIndex, 2, "Level 2 Paragraph 06");
AppendNumberingListParagraph(document, listIndex, 0, "Level 0 Paragraph 07");
AppendNumberingListParagraph(document, listIndex, 1, "Level 1 Paragraph 08");
AppendNumberingListParagraph(document, listIndex, 1, "Level 1 Paragraph 09");
AppendNumberingListParagraph(document, listIndex, 0, "Level 0 Paragraph 10");

document.EndUpdate();
728x90
반응형
그리드형
Posted by 사용자 icodebroker

댓글을 달아 주세요