텍스트 스타일로 작업합니다

글꼴 색상, 크기를 변경하고 RichText 노드의 모든 텍스트를 강조 표시

이 주제는 글꼴 색상, 크기 변경 및 RichText 노드의 모든 텍스트를 강조 표시하는 것에 대해 설명합니다. 이 기능은 개발자에 대한 OneNote를보다 심층적으로 제어 할 수 있습니다. 이 기능을 사용하여 개발자는 원하는 리치 텍스트 노드의 글꼴 색상, 크기 및 강조 표시를 사용자 정의 할 수 있습니다.

aspose.note를 사용하여 풍부한 텍스트 노드의 글꼴과 색상을 변경하려면 아래 단계를 따르십시오.

  1. OneNote 문서를 문서 클래스로로드하십시오.
  2. 글꼴과 색상이 변경 될 Richtext 노드에 액세스하십시오.
  3. 액세스 텍스트 스타일.
  4. 텍스트의 글꼴과 색상을 설정하십시오.
 1string dataDir = RunExamples.GetDataDir_Text();
 2
 3// Load the document into Aspose.Note.
 4Document document = new Document(dataDir + "Aspose.one");
 5// Get a particular RichText node
 6IList<RichText> richTextNodes = document.GetChildNodes<RichText>();
 7RichText richText = richTextNodes[0];
 8
 9foreach (TextStyle style in richText.Styles)
10{
11    // Set font color
12    style.FontColor = Color.Yellow;
13    // Set highlight color
14    style.Highlight = Color.Blue;
15    // Set font size
16    style.FontSize = 20;
17}         

Set default paragraph style settings

Set proofing language for a text

Apply Dark mode style

The following code example demonstrates how to make OneNote document to look like in Dark mode.

 1// The path to the documents directory.
 2string dataDir = RunExamples.GetDataDir_Text();
 3
 4// Load the document into Aspose.Note.
 5Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));
 6
 7foreach (var page in doc)
 8{
 9    page.BackgroundColor = Color.Black;
10}
11
12foreach (var node in doc.GetChildNodes<RichText>())
13{   
14    var c = node.ParagraphStyle.FontColor;
15    if (c.IsEmpty || Math.Abs(c.R - Color.Black.R) + Math.Abs(c.G - Color.Black.G) + Math.Abs(c.B - Color.Black.B) <= 30)
16    {
17        node.ParagraphStyle.FontColor = Color.White;
18    }
19}
20
21doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.