RichText.Append
محتويات
[
يخفي
]Append(string, TextStyle)
يضيف سلسلة إلى النهاية .
public RichText Append(string value, TextStyle style)
| معامل | يكتب | وصف | 
|---|---|---|
| value | String | القيمة المضافة . | 
| style | TextStyle | نمط السلسلة المضافة . | 
قيمة الإرجاع
ملفRichText .
أمثلة
تعيين لغة التدقيق للنص.
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"));
التلاعب بتنسيق النص باستخدام نمط الفقرة.
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"));
يوضح كيفية ربط ارتباط تشعبي بنص.
// المسار إلى دليل المستندات.
string dataDir = RunExamples.GetDataDir_Tasks();
// إنشاء كائن من فئة المستند
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);
// أضف عناصر المخطط التفصيلي
outline.AppendChildLast(outlineElem);
// تهيئة كائن فئة العنوان
Title title = new Title() { TitleText = titleText };
// تهيئة كائن فئة الصفحة
Page page = new Note.Page() { Title = title };
// إضافة عقدة المخطط التفصيلي
page.AppendChildLast(outline);
// إضافة عقدة الصفحة
doc.AppendChildLast(page);
// حفظ مستند OneNote
dataDir = dataDir + "AddHyperlink_out.one";
doc.Save(dataDir);
يوضح كيفية إنشاء مستند بنص منسق.
// المسار إلى دليل المستندات.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
// إنشاء كائن من فئة المستند
Document doc = new Document();
// تهيئة كائن فئة الصفحة
Page page = new Page();
// تهيئة كائن فئة العنوان
Title title = new Title();
// تهيئة كائن فئة TextStyle وتعيين خصائص التنسيق
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;
// تعيين عنوان الصفحة
page.Title = title;
// إضافة عقدة RichText
outlineElem.AppendChildLast(text);
// إضافة عقدة OutlineElement
outline.AppendChildLast(outlineElem);
// إضافة عقدة المخطط التفصيلي
page.AppendChildLast(outline);
// إضافة عقدة الصفحة
doc.AppendChildLast(page);
// حفظ مستند OneNote
dataDir = dataDir + "CreateDocWithFormattedRichText_out.one";
doc.Save(dataDir);
أنظر أيضا
- class TextStyle
- class RichText
- مساحة الاسم Aspose.Note
- المجسم Aspose.Note
Append(string)
يضيف سلسلة إلى آخر نطاق نصي.
public RichText Append(string value)
| معامل | يكتب | وصف | 
|---|---|---|
| value | String | القيمة المضافة . | 
قيمة الإرجاع
ملفRichText .
أمثلة
التلاعب بتنسيق النص باستخدام نمط الفقرة.
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"));
يوضح كيفية ربط ارتباط تشعبي بنص.
// المسار إلى دليل المستندات.
string dataDir = RunExamples.GetDataDir_Tasks();
// إنشاء كائن من فئة المستند
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);
// أضف عناصر المخطط التفصيلي
outline.AppendChildLast(outlineElem);
// تهيئة كائن فئة العنوان
Title title = new Title() { TitleText = titleText };
// تهيئة كائن فئة الصفحة
Page page = new Note.Page() { Title = title };
// إضافة عقدة المخطط التفصيلي
page.AppendChildLast(outline);
// إضافة عقدة الصفحة
doc.AppendChildLast(page);
// حفظ مستند OneNote
dataDir = dataDir + "AddHyperlink_out.one";
doc.Save(dataDir);
أنظر أيضا
- class RichText
- مساحة الاسم Aspose.Note
- المجسم Aspose.Note