diff --git a/Examples/CSharp/CSharp.csproj b/Examples/CSharp/CSharp.csproj index 1a0fab7..d080093 100644 --- a/Examples/CSharp/CSharp.csproj +++ b/Examples/CSharp/CSharp.csproj @@ -145,6 +145,8 @@ + + diff --git a/Examples/CSharp/RunExamples.cs b/Examples/CSharp/RunExamples.cs index 22ed24e..3a4540c 100644 --- a/Examples/CSharp/RunExamples.cs +++ b/Examples/CSharp/RunExamples.cs @@ -122,6 +122,8 @@ public static void Main() //CreateTitleMsStyle.Run(); //ChangeStyle.Run(); //ChangePageTitleStyle.Run(); + SetDefaultParagraphStyle.Run(); + SetProofingLanguageForText.Run(); //// ===================================================== #endregion diff --git a/Examples/CSharp/Text/SetDefaultParagraphStyle.cs b/Examples/CSharp/Text/SetDefaultParagraphStyle.cs new file mode 100644 index 0000000..e956181 --- /dev/null +++ b/Examples/CSharp/Text/SetDefaultParagraphStyle.cs @@ -0,0 +1,74 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) 2002-2021 Aspose Pty Ltd. All Rights Reserved. +// +// ----------------------------------------------------------------------- + +namespace Aspose.Note.Examples.CSharp.Text +{ + using System; + using System.IO; + + class SetDefaultParagraphStyle + { + public static void Run() + { + // ExStart:SetDefaultParagraphStyle + // ExFor:ParagraphStyle + // ExFor:ParagraphStyle.FontName + // ExFor:ParagraphStyle.FontSize + // ExFor:RichText + // ExFor:RichText.ParagraphStyle + // ExFor:RichText.Text + // ExFor:TextStyle + // ExFor:TextStyle.FontName + // ExFor:TextStyle.FontSize + // ExSummary:Manipulate by text format using paragraph style. + + var document = new Document(); + var page = new Page(document); + var outline = new Outline(document); + var outlineElem = new OutlineElement(document); + + var text = new RichText(document) + { + Text = $"DefaultParagraphFontAndSize{Environment.NewLine}OnlyDefaultParagraphFont{Environment.NewLine}OnlyDefaultParagraphFontSize", + ParagraphStyle = new ParagraphStyle() + { + FontName = "Courier New", + FontSize = 20 + } + }; + + // Font and font size are from text.ParagraphStyle + text.Styles.Add(new TextStyle() + { + RunIndex = 27 + }); + + // Only font is from text.ParagraphStyle + text.Styles.Add(new TextStyle() + { + FontSize = 14, + RunIndex = 53 + }); + + // Only font size is from text.ParagraphStyle + text.Styles.Add(new TextStyle() + { + FontName = "Verdana", + RunIndex = text.Text.Length + }); + + + outlineElem.AppendChildLast(text); + outline.AppendChildLast(outlineElem); + page.AppendChildLast(outline); + document.AppendChildLast(page); + + document.Save(Path.Combine(RunExamples.GetDataDir_Text(), "SetDefaultParagraphStyle.one")); + + // ExEnd:SetDefaultParagraphStyle + } + } +} \ No newline at end of file diff --git a/Examples/CSharp/Text/SetProofingLanguageForText.cs b/Examples/CSharp/Text/SetProofingLanguageForText.cs new file mode 100644 index 0000000..c88f8bb --- /dev/null +++ b/Examples/CSharp/Text/SetProofingLanguageForText.cs @@ -0,0 +1,58 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) 2002-2021 Aspose Pty Ltd. All Rights Reserved. +// +// ----------------------------------------------------------------------- + +namespace Aspose.Note.Examples.CSharp.Text +{ + using System; + using System.Globalization; + using System.IO; + + class SetProofingLanguageForText + { + public static void Run() + { + // ExStart:SetProofingLanguageForText + // ExFor:TextStyle + // ExFor:TextStyle.Language + // ExFor:TextStyle.RunIndex + // ExFor:RichText + // ExFor:RichText.Styles + // ExSummary:Set proofing language for a text. + + var document = new Document(); + var page = new Page(document); + var outline = new Outline(document); + var outlineElem = new OutlineElement(document); + + var text = new RichText(document) { Text = "United States Germany China", ParagraphStyle = ParagraphStyle.Default }; + text.Styles.Add(new TextStyle() + { + Language = CultureInfo.GetCultureInfo("en-US"), + RunIndex = 13 + }); + text.Styles.Add(new TextStyle() + { + Language = CultureInfo.GetCultureInfo("de-DE"), + RunIndex = 21 + }); + text.Styles.Add(new TextStyle() + { + Language = CultureInfo.GetCultureInfo("zh-CN"), + RunIndex = text.Text.Length + }); + + + outlineElem.AppendChildLast(text); + outline.AppendChildLast(outlineElem); + page.AppendChildLast(outline); + document.AppendChildLast(page); + + document.Save(Path.Combine(RunExamples.GetDataDir_Text(), "SetProofingLanguageForText.one")); + + // ExEnd:SetProofingLanguageForText + } + } +} \ No newline at end of file