RichText.Append
inhoud
[
verbergen
]Append(string, TextStyle)
Voegt een string toe aan het einde.
public RichText Append(string value, TextStyle style)
| Parameter | Type | Beschrijving | 
|---|---|---|
| value | String | De toegevoegde waarde. | 
| style | TextStyle | De stijl van toegevoegde string. | 
Winstwaarde
DeRichText .
Voorbeelden
Taal voor proeflezen instellen voor een tekst.
var document = new Document();
var page = new Page();
var outline = new Outline();
var outlineElem = new OutlineElement();
var text = new RichText() { ParagraphStyle = ParagraphStyle.Default };
text.Append("United States", new TextStyle() { Language = CultureInfo.GetCultureInfo("en-US") })
    .Append(" Germany", new TextStyle() { Language = CultureInfo.GetCultureInfo("de-DE") })
    .Append(" China", new TextStyle() { Language = CultureInfo.GetCultureInfo("zh-CN") });
outlineElem.AppendChildLast(text);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
document.AppendChildLast(page);
document.Save(Path.Combine(RunExamples.GetDataDir_Text(), "SetProofingLanguageForText.one"));
Manipuleer op tekstformaat met behulp van alineastijl.
var document = new Document();
var page = new Page();
var outline = new Outline();
var outlineElem = new OutlineElement();
var text = new RichText() { ParagraphStyle = new ParagraphStyle() { FontName = "Courier New", FontSize = 20 } }
                .Append($"DefaultParagraphFontAndSize{Environment.NewLine}")
                .Append($"OnlyDefaultParagraphFont{Environment.NewLine}", new TextStyle() { FontSize = 14 })
                .Append("OnlyDefaultParagraphFontSize", new TextStyle() { FontName = "Verdana" });
outlineElem.AppendChildLast(text);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
document.AppendChildLast(page);
document.Save(Path.Combine(RunExamples.GetDataDir_Text(), "SetDefaultParagraphStyle.one"));
Laat zien hoe u een hyperlink aan een tekst koppelt.
// Het pad naar de documentenmap.
string dataDir = RunExamples.GetDataDir_Tasks();
// Maak een object van de klasse Document
Document doc = new Document();
RichText titleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append("Title!");
Outline outline = new Outline()
                      {
                          MaxWidth = 200,
                          MaxHeight = 200,
                          VerticalOffset = 100,
                          HorizontalOffset = 100
                      };
TextStyle textStyleRed = new TextStyle
                             {
                                 FontColor = Color.Red,
                                 FontName = "Arial",
                                 FontSize = 10,
                             };
TextStyle textStyleHyperlink = new TextStyle
                                   {
                                       IsHyperlink = true,
                                       HyperlinkAddress = "www.google.com"
                                   };
RichText text = new RichText() { ParagraphStyle = ParagraphStyle.Default }
                    .Append("This is ", textStyleRed)
                    .Append("hyperlink", textStyleHyperlink)
                    .Append(". This text is not a hyperlink.", TextStyle.Default);
OutlineElement outlineElem = new OutlineElement();
outlineElem.AppendChildLast(text);
// Voeg overzichtselementen toe
outline.AppendChildLast(outlineElem);
// Initialiseer het titelklasse-object
Title title = new Title() { TitleText = titleText };
// Initialiseer het paginaklasse-object
Page page = new Note.Page() { Title = title };
// Overzichtsknooppunt toevoegen
page.AppendChildLast(outline);
// Paginaknooppunt toevoegen
doc.AppendChildLast(page);
// Sla OneNote-document op
dataDir = dataDir + "AddHyperlink_out.one";
doc.Save(dataDir);
Laat zien hoe u een document maakt met opgemaakte RTF-tekst.
// Het pad naar de documentenmap.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// Maak een object van de klasse Document
Document doc = new Document();
// Initialiseer het paginaklasse-object
Page page = new Page();
// Initialiseer het titelklasse-object
Title title = new Title();
// Initialiseer het klasseobject TextStyle en stel opmaakeigenschappen in
ParagraphStyle defaultTextStyle = new ParagraphStyle
                                      {
                                          FontColor = Color.Black,
                                          FontName = "Arial",
                                          FontSize = 10
                                      };
RichText titleText = new RichText() { ParagraphStyle = defaultTextStyle }.Append("Title!");
Outline outline = new Outline()
                      {
                          VerticalOffset = 100,
                          HorizontalOffset = 100
                      };
OutlineElement outlineElem = new OutlineElement();
TextStyle textStyleForHelloWord = new TextStyle
                                      {
                                          FontColor = Color.Red,
                                          FontName = "Arial",
                                          FontSize = 10,
                                      };
TextStyle textStyleForOneNoteWord = new TextStyle
                                        {
                                            FontColor = Color.Green,
                                            FontName = "Calibri",
                                            FontSize = 10,
                                            IsItalic = true,
                                        };
TextStyle textStyleForTextWord = new TextStyle
                                     {
                                         FontColor = Color.Blue,
                                         FontName = "Arial",
                                         FontSize = 15,
                                         IsBold = true,
                                         IsItalic = true,
                                     };
RichText text = new RichText() { ParagraphStyle = defaultTextStyle }
                    .Append("Hello", textStyleForHelloWord)
                    .Append(" OneNote", textStyleForOneNoteWord)
                    .Append(" text", textStyleForTextWord)
                    .Append("!", TextStyle.Default);
title.TitleText = titleText;
// Stel paginatitel in
page.Title = title;
// RichText-knooppunt toevoegen
outlineElem.AppendChildLast(text);
// Voeg een OutlineElement-knooppunt toe
outline.AppendChildLast(outlineElem);
// Overzichtsknooppunt toevoegen
page.AppendChildLast(outline);
// Paginaknooppunt toevoegen
doc.AppendChildLast(page);
// Sla OneNote-document op
dataDir = dataDir + "CreateDocWithFormattedRichText_out.one";
doc.Save(dataDir);
Zie ook
- class TextStyle
- class RichText
- naamruimte Aspose.Note
- montage Aspose.Note
Append(string)
Voegt een tekenreeks toe aan het laatste tekstbereik.
public RichText Append(string value)
| Parameter | Type | Beschrijving | 
|---|---|---|
| value | String | De toegevoegde waarde. | 
Winstwaarde
DeRichText .
Voorbeelden
Manipuleer op tekstformaat met behulp van alineastijl.
var document = new Document();
var page = new Page();
var outline = new Outline();
var outlineElem = new OutlineElement();
var text = new RichText() { ParagraphStyle = new ParagraphStyle() { FontName = "Courier New", FontSize = 20 } }
                .Append($"DefaultParagraphFontAndSize{Environment.NewLine}")
                .Append($"OnlyDefaultParagraphFont{Environment.NewLine}", new TextStyle() { FontSize = 14 })
                .Append("OnlyDefaultParagraphFontSize", new TextStyle() { FontName = "Verdana" });
outlineElem.AppendChildLast(text);
outline.AppendChildLast(outlineElem);
page.AppendChildLast(outline);
document.AppendChildLast(page);
document.Save(Path.Combine(RunExamples.GetDataDir_Text(), "SetDefaultParagraphStyle.one"));
Laat zien hoe u een hyperlink aan een tekst koppelt.
// Het pad naar de documentenmap.
string dataDir = RunExamples.GetDataDir_Tasks();
// Maak een object van de klasse Document
Document doc = new Document();
RichText titleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append("Title!");
Outline outline = new Outline()
                      {
                          MaxWidth = 200,
                          MaxHeight = 200,
                          VerticalOffset = 100,
                          HorizontalOffset = 100
                      };
TextStyle textStyleRed = new TextStyle
                             {
                                 FontColor = Color.Red,
                                 FontName = "Arial",
                                 FontSize = 10,
                             };
TextStyle textStyleHyperlink = new TextStyle
                                   {
                                       IsHyperlink = true,
                                       HyperlinkAddress = "www.google.com"
                                   };
RichText text = new RichText() { ParagraphStyle = ParagraphStyle.Default }
                    .Append("This is ", textStyleRed)
                    .Append("hyperlink", textStyleHyperlink)
                    .Append(". This text is not a hyperlink.", TextStyle.Default);
OutlineElement outlineElem = new OutlineElement();
outlineElem.AppendChildLast(text);
// Voeg overzichtselementen toe
outline.AppendChildLast(outlineElem);
// Initialiseer het titelklasse-object
Title title = new Title() { TitleText = titleText };
// Initialiseer het paginaklasse-object
Page page = new Note.Page() { Title = title };
// Overzichtsknooppunt toevoegen
page.AppendChildLast(outline);
// Paginaknooppunt toevoegen
doc.AppendChildLast(page);
// Sla OneNote-document op
dataDir = dataDir + "AddHyperlink_out.one";
doc.Save(dataDir);
Zie ook
- class RichText
- naamruimte Aspose.Note
- montage Aspose.Note