Class TextStyle

Class TextStyle

Nombre del espacio: Aspose.Note Asamblea: Aspose.Note.dll (25.4.0)

Especifica el estilo de texto.

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

Miembros heredados

Style.GetHashCode() ,y, Style.IsBold ,y, Style.IsItalic ,y, Style.IsUnderline ,y, Style.IsStrikethrough ,y, Style.IsSuperscript ,y, Style.IsSubscript ,y, Style.FontName ,y, Style.FontSize ,y, Style.FontColor ,y, Style.Highlight ,y, Style.FontStyle ,y, object.GetType() ,y, object.ToString() ,y, object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) ,y, object.GetHashCode()

Examples

Enfatizemos los títulos de la página entre otros títulos aumentando el tamaño de las letras.

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

Enfatizamos los últimos cambios en el texto al destacar.

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

Configura el lenguaje de prueba para un texto.

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

Manipular por formato de texto utilizando el estilo de parágrafo.

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

Mostra cómo conectar un hiperenlace a un texto.

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

El estilo de texto()

public TextStyle()
   {
   }

Properties

Default

Tiene el estilo con la cultura “en-US”.

public static TextStyle Default
   {
      get;
   }

Valor de la propiedad

TextStyle

DefaultMsOneNoteTitleDateStyle

Obtenga el estilo por defecto para la fecha de título en MS OneNote.

public static TextStyle DefaultMsOneNoteTitleDateStyle
   {
      get;
   }

Valor de la propiedad

TextStyle

DefaultMsOneNoteTitleTextStyle

Obtenga el estilo por defecto para el texto de título en MS OneNote.

public static TextStyle DefaultMsOneNoteTitleTextStyle
   {
      get;
   }

Valor de la propiedad

TextStyle

DefaultMsOneNoteTitleTimeStyle

Obtenga el estilo por defecto para el tiempo de título en MS OneNote.

public static TextStyle DefaultMsOneNoteTitleTimeStyle
   {
      get;
   }

Valor de la propiedad

TextStyle

HyperlinkAddress

Obtenga o establece la dirección de hiperenlace. debe ser establecido si el valor de la propiedad Aspose.Note.TextStyle.IsHyperlink es verdadero.

public string HyperlinkAddress
   {
      get;
      set;
   }

Valor de la propiedad

string

Examples

Mostra cómo conectar un hiperenlace a un texto.

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

Recibe o establece un valor que indica si el estilo de texto está oculto.

public bool IsHidden
   {
      get;
      set;
   }

Valor de la propiedad

bool

IsHyperlink

Obtenga o establece un valor que indique si el estilo de texto es hiperlink.

public bool IsHyperlink
   {
      get;
      set;
   }

Valor de la propiedad

bool

Examples

Mostra cómo conectar un hiperenlace a un texto.

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

Obtenga o establece un valor que indica si el estilo de texto es matemático.

public bool IsMathFormatting
   {
      get;
      set;
   }

Valor de la propiedad

bool

Language

Obtenga o establece el lenguaje del texto.

public CultureInfo language { get; set; }

Valor de la propiedad

CultureInfo

Examples

Configura el lenguaje de prueba para un texto.

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

Returns System.Globalization.CultureInfo.InvariantCultura si la propiedad no está establecida.

Methods

Los objetos (objetos)

Determina si el objeto especificado es igual al objeto actual.

public override bool Equals(object obj)
   {
   }

Parameters

obj object

El objeto .

Returns

bool

El sistema.Boolean

EQUALES (Estilo de texto)

Determina si el objeto especificado es igual al objeto actual.

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

Parameters

other TextStyle

El objeto .

Returns

bool

El sistema.Boolean

Título: GetHashCode

Serve como una función de hash para el tipo.

public override int GetHashCode()
   {
   }

Returns

int

El sistema.Int32.

 Español