Class TextStyle

Class TextStyle

نام ها : Aspose.Note جمع آوری: Aspose.Note.dll (25.4.0)

سبک متن را مشخص کنید.

public sealed class TextStyle : Style
   {
       private Font _font;
       private bool _isBold;
       private bool _isItalic;
       private int _baselineShift;
       public bool IsBold
       {
           get { return _isBold; }
       }
       public int BaselineShift
       {
           get { return _baselineShift; }
       }
       private Font Font
       {
           get { return _font; }
           set { _font = value; }
       }
       public bool IsItalic
       {
           get { return _isItalic; }
           set { _isItalic = value; }
       }
   }

Inheritance

object Style TextStyle

اعضای ارثی

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.AddDays(-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 = 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 };
   Note.Page page = new Note.Page() { Title = title };
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "AddHyperlink_out.one";
   doc.Save(dataDir);

Constructors

کلمات متن()

public TextStyle()
   {
   }

Properties

Default

با فرهنگ «در آمریکا» روبرو می شویم.

public static TextStyle Default
   {
      get;
   }

ارزش املاک

TextStyle

DefaultMsOneNoteTitleDateStyle

سبک پیش فرض برای تاریخ عنوان در MS OneNote دریافت می شود.

public static TextStyle DefaultMsOneNoteTitleDateStyle
   {
      get;
   }

ارزش املاک

TextStyle

DefaultMsOneNoteTitleTextStyle

سبک پیش فرض برای متن عنوان در MS OneNote دریافت می شود.

public static TextStyle DefaultMsOneNoteTitleTextStyle
   {
      get;
   }

ارزش املاک

TextStyle

DefaultMsOneNoteTitleTimeStyle

سبک پیش فرض برای زمان عنوان در MS OneNote دریافت می شود.

public static TextStyle DefaultMsOneNoteTitleTimeStyle
   {
      get;
   }

ارزش املاک

TextStyle

HyperlinkAddress

آدرس هیپر لینک را دریافت یا تنظیم کنید. باید تعیین شود که آیا ارزش مالکیت Aspose.Note.TextStyle.IsHyperlink درست است.

public string HyperlinkAddress
   {
      get;
      set;
   }

ارزش املاک

string

Examples

نشان می دهد که چگونه یک هیپر لینک را به یک متن متصل کنیم.

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 };
   Note.Page page = new Note.Page() { Title = title };
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "AddHyperlink_out.one";
   doc.Save(dataDir);

IsHidden

دریافت یا تنظیم یک مقدار نشان می دهد که آیا سبک متن پنهان است.

public bool IsHidden
   {
      get;
      set;
   }

ارزش املاک

bool

IsHyperlink

یک مقدار دریافت یا تنظیم می کند که نشان می دهد که آیا سبک متن هیپر لینک است یا خیر.

public bool IsHyperlink
   {
      get;
      set;
   }

ارزش املاک

bool

Examples

نشان می دهد که چگونه یک هیپر لینک را به یک متن متصل کنیم.

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);
   dataDir = dataDir + "AddHyperlink_out.one";
   doc.Save(dataDir);

IsMathFormatting

دریافت یا تنظیم یک مقدار نشان می دهد که آیا سبک متن ریاضی است.

public bool IsMathFormatting
   {
      get;
      set;
   }

ارزش املاک

bool

Language

دریافت یا تنظیم زبان متن.

public CultureInfo language { get; set; }

ارزش املاک

CultureInfo

Examples

زبان ثابت را برای یک متن تنظیم کنید.

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"));

Remarks

بازگشت سیستم.Globalization.CultureInfo.Invariantتولید اگر دارایی تنظیم نشده است.

Methods

مساوی ( Object )

تعیین می کند که آیا موضوع مشخص شده برابر با موضوع فعلی است یا خیر.

public override bool Equals(object obj)
   {
   }

Parameters

obj object

موضوع است.

Returns

bool

سیستم : بولیان

سبک متن ( TextStyle )

تعیین می کند که آیا موضوع مشخص شده برابر با موضوع فعلی است یا خیر.

public bool Equals(TextStyle other)
   {
      return this.IsEqual(other);
   }

Parameters

other TextStyle

موضوع است.

Returns

bool

سیستم : بولیان

بایگانی برچسب ها:

به عنوان یک عملکرد هش برای این نوع عمل می کند.

public override int GetHashCode()
   {
   }

Returns

int

سیستم .Int32.

 فارسی