Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Examples/CSharp/CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@
<Compile Include="Text\ReplaceTextOnAllPages.cs" />
<Compile Include="Text\ReplaceTextOnParticularPage.cs" />
<Compile Include="RunExamples.cs" />
<Compile Include="Text\SetDefaultParagraphStyle.cs" />
<Compile Include="Text\SetProofingLanguageForText.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down
2 changes: 2 additions & 0 deletions Examples/CSharp/RunExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ public static void Main()
//CreateTitleMsStyle.Run();
//ChangeStyle.Run();
//ChangePageTitleStyle.Run();
SetDefaultParagraphStyle.Run();
SetProofingLanguageForText.Run();

//// =====================================================
#endregion
Expand Down
74 changes: 74 additions & 0 deletions Examples/CSharp/Text/SetDefaultParagraphStyle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// -----------------------------------------------------------------------
// <copyright file="SetDefaultParagraphStyle.cs" company="Aspose Pty Ltd">
// Copyright (c) 2002-2021 Aspose Pty Ltd. All Rights Reserved.
// </copyright>
// -----------------------------------------------------------------------

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
}
}
}
58 changes: 58 additions & 0 deletions Examples/CSharp/Text/SetProofingLanguageForText.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// -----------------------------------------------------------------------
// <copyright file="SetProofingLanguageForText.cs" company="Aspose Pty Ltd">
// Copyright (c) 2002-2021 Aspose Pty Ltd. All Rights Reserved.
// </copyright>
// -----------------------------------------------------------------------

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
}
}
}