Class ParagraphStyle
名称: Aspose.Note 集合: Aspose.Note.dll (25.4.0)
文本风格设置可以使用,如果在 Aspose.Note.RichText.Styles 收藏中没有相匹配的 TextTyle 对象,或者这个对体不指定所需的设置。
public sealed class ParagraphStyle : Style, IEquatable<ParagraphStyle>
{
public bool IsDefault()
{
}
public void SetNextIndent(Unit value)
{
}
public void SetNextKeepWithNext(bool flag)
{
}
public override int GetHashCode()
{
}
public bool Equals(ParagraphStyle other)
{
}
}
Inheritance
object ← Style ← ParagraphStyle
Implements
继承人
Style.GetHashCode() , Style.IsBold , Style.IsItalic , Style.IsUnderline , Style.IsStrikethrough , Style.IsSuperscript , Style.IsSubscript , Style.FontName , Style.FontSize , Style.FontColor , Style.Highlight , Style.FontStyle , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
让我们在其他标题中突出页面名称,通过增加字体大小。
string dataDir = RunExamples.GetDataDir_Text();
Document document = new Document(dataDir + "Aspose.one");
foreach (var title in document.Select(e => e.Title.TitleText))
{
title.ParagraphStyle.FontSize = 24;
title.ParagraphStyle.IsBold = true;
foreach (var run in title.TextRuns)
{
run.Style.FontSize = 24;
run.Style.IsBold = true;
}
}
document.Save(Path.Combine(dataDir, "ChangePageTitleStyle.pdf"));
让我们通过突出来强调最新文本的变化。
string dataDir = RunExamples.GetDataDir_Text();
Document document = new Document(dataDir + "Aspose.one");
var richTextNodes = document.GetChildNodes<RichText>().Where(e => e.LastModifiedTime >= DateTime.Today.Subtract(TimeSpan.FromDays(7)));
foreach (var node in richTextNodes)
{
node.ParagraphStyle.Highlight = Color.DarkGreen;
foreach (var run in node.TextRuns)
{
run.Style.Highlight = Color.DarkSeaGreen;
}
}
document.Save(Path.Combine(dataDir, "HighlightAllRecentChanges.pdf"));
用文本格式操纵使用段落风格。
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_Text();
Aspose.Note.Document doc = new Aspose.Note.Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
OutlineElement outlineElem1 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) };
RichText text1 = new RichText(doc) { Text = "First", ParagraphStyle = defaultStyle };
outlineElem1.AppendChildLast(text1);
OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) };
RichText text2 = new RichText(doc) { Text = "Second", ParagraphStyle = defaultStyle };
outlineElem2.AppendChildLast(text2);
OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.ChineseCounting, "Arial", 10) };
RichText text3 = new RichText(doc) { Text = "Third", ParagraphStyle = defaultStyle };
outlineElem3.AppendChildLast(text3);
outline.AppendChildLast(outlineElem1);
outline.AppendChildLast(outlineElem2);
outline.AppendChildLast(outlineElem3);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir = dataDir + "InsertChineseNumberList_out.one";
doc.Save(dataDir);
顯示如何插入新的泡沫 lis。
string dataDir = RunExamples.GetDataDir_Text();
Aspose.Note.Document doc = new Aspose.Note.Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
OutlineElement outlineElem1 = new OutlineElement(doc) { NumberList = new NumberList("*", "Arial", 10) };
RichText text1 = new RichText(doc) { Text = "First", ParagraphStyle = defaultStyle };
outlineElem1.AppendChildLast(text1);
OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("*", "Arial", 10) };
RichText text2 = new RichText(doc) { Text = "Second", ParagraphStyle = defaultStyle };
outlineElem2.AppendChildLast(text2);
OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("*", "Arial", 10) };
RichText text3 = new RichText(doc) { Text = "Third", ParagraphStyle = defaultStyle };
outlineElem3.AppendChildLast(text3);
outline.AppendChildLast(outlineElem1);
outline.AppendChildLast(outlineElem2);
outline.AppendChildLast(outlineElem3);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir = dataDir + "ApplyBulletsOnText_out.one";
doc.Save(dataDir);
显示如何通过编号输入新的列表。
string dataDir = RunExamples.GetDataDir_Text();
Document doc = new Document();
Aspose.Note.Page page = new Aspose.Note.Page(doc);
Outline outline = new Outline(doc);
ParagraphStyle defaultStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
OutlineElement outlineElem1 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) };
RichText text1 = new RichText(doc) { Text = "First", ParagraphStyle = defaultStyle };
outlineElem1.AppendChildLast(text1);
OutlineElement outlineElem2 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) };
RichText text2 = new RichText(doc) { Text = "Second", ParagraphStyle = defaultStyle };
outlineElem2.AppendChildLast(text2);
OutlineElement outlineElem3 = new OutlineElement(doc) { NumberList = new NumberList("{0})", NumberFormat.DecimalNumbers, "Arial", 10) };
RichText text3 = new RichText(doc) { Text = "Third", ParagraphStyle = defaultStyle };
outlineElem3.AppendChildLast(text3);
outline.AppendChildLast(outlineElem1);
outline.AppendChildLast(outlineElem2);
outline.AppendChildLast(outlineElem3);
page.AppendChildLast(outline);
doc.AppendChildLast(page);
dataDir = dataDir + "ApplyNumberingOnText_out.one";
doc.Save(dataDir);
Constructors
字符串( )
启动 Aspose.Note.ParagraphStyle 类的新例子。
public ParagraphStyle()
{
}
Properties
Default
通过默认设置获取 ParagraphStyle。
public static ParagraphStyle Default
{
get;
}
财产价值
Methods
平等(对象)
确定所指定的对象是否与当前对象相同。
public override bool Equals(object obj)
{
}
Parameters
obj
object
对象。
Returns
这个系统,Boolean。
平等(Style)
确定所指定的对象是否与当前对象相同。
public bool Equals(ParagraphStyle other)
{
if (other == null)
return false;
return this.Name == other.Name &&
this.Color == other.Color &&
this.Alignment == other.Alignment &&
this.Format.Equals(other.Format);
}
Parameters
other
ParagraphStyle
对象。
Returns
这个系统,Boolean。
GetHashCode( )
作为该类型的Hash函数。
public override int GetHashCode()
{
}
Returns
此分類上一篇: Int32