Class TableCell

Class TableCell

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

Representa una célula de mesa.

public sealed class TableCell : IndentatedNode<iOutlineChildNode>, INode, ICompositeNode<iOutlineChildNode>, ICompositeNode, IEnumerable<iOutlineChildNode>, IEnumerable, IIndentatedNode
   {
      public override string Text { get; set; }
      public int RowIndex { get; set; }
      public int ColumnIndex { get; set; }
   }

Inheritance

object Node CompositeNodeBase CompositeNode IndentatedNode TableCell

Implements

INode ,y, ICompositeNode ,y, ICompositeNode ,y, IEnumerable ,y, IEnumerable ,y, IIndentatedNode

Miembros heredados

IndentatedNode.IndentPosition ,y, CompositeNode.GetEnumerator() ,y, CompositeNode.InsertChild(int, T1) ,y, CompositeNode.InsertChildrenRange(int, IEnumerable) ,y, CompositeNode.InsertChildrenRange(int, params IOutlineChildNode[]) ,y, CompositeNode.AppendChildFirst(T1) ,y, CompositeNode.AppendChildLast(T1) ,y, CompositeNode.RemoveChild(T1) ,y, CompositeNode.Accept(DocumentVisitor) ,y, CompositeNode.GetChildNodes(NodeType) ,y, CompositeNode.GetChildNodes() ,y, CompositeNode.IsComposite ,y, CompositeNode.FirstChild ,y, CompositeNode.LastChild ,y, CompositeNodeBase.GetChildNodes(NodeType) ,y, CompositeNodeBase.GetChildNodes() ,y, Node.Accept(DocumentVisitor) ,y, Node.Document ,y, Node.IsComposite ,y, Node.NodeType ,y, Node.ParentNode ,y, Node.PreviousSibling ,y, Node.NextSibling ,y, object.GetType() ,y, object.ToString() ,y, object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) ,y, object.GetHashCode()

Examples

Mostra cómo obtener texto de las células de una mesa.

string dataDir = RunExamples.GetDataDir_Tables();
   Document document = new Document(dataDir + "Sample1.one");
   IList<Table> nodes = document.GetChildNodes<Table>();
   foreach (Table table in nodes)
   {
      foreach (TableRow row in table)
      {
         IList<TableCell> cells = row.GetChildNodes<TableCell>();
         foreach (TableCell cell in cells)
         {
            string text = string.Join(Environment.NewLine, cell.GetChildNodes<RichText>().Select(e => e.Text)) + Environment.NewLine;
            Console.WriteLine(text);
         }
      }
   }

Mostra cómo definir un color de fondo para una célula.

Document doc = new Document();
   TableCell cell11 = new TableCell(doc);
   cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text"));
   cell11.BackgroundColor = Color.Coral;
   TableRow row = new TableRow(doc);
   row.AppendChildLast(cell11);
   TableColumn column = new TableColumn() { Width = 200 };
   Table table = new Table(doc)
   {
       IsBordersVisible = true,
       Columns = { column }
   };
   table.AppendChildLast(row);
   OutlineElement oe = new OutlineElement(doc);
   oe.AppendChildLast(table);
   Outline o = new Outline(doc);
   o.AppendChildLast(oe);
   Page page = new Page(doc);
   page.AppendChildLast(o);
   doc.AppendChildLast(page);
   doc.Save(Path.Combine(RunExamples.GetDataDir_Tables(), "SettingCellBackGroundColor.pdf"));

Mostra cómo añadir una nueva tabla con una etiqueta.

string dataDir = RunExamples.GetDataDir_Tags();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   TableRow row = new TableRow(doc);
   TableCell cell = new TableCell(doc);
   cell.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Single cell."));
   row.AppendChildLast(cell);
   Table table = new Table(doc)
   {
      IsBordersVisible = true,
      Columns = { new TableColumn { Width = 70 } }
   };
   table.AppendChildLast(row);
   table.Tags.Add(NoteTag.CreateQuestionMark());
   OutlineElement outlineElem = new OutlineElement(doc);
   outlineElem.AppendChildLast(table);
   Outline outline = new Outline(doc);
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "AddTableNodeWithTag_out.one";
   doc.Save(dataDir);

Mostra cómo crear una tabla con una columna cerrada.

string dataDir = RunExamples.GetDataDir_Tables();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   TableRow row1 = new TableRow(doc);
   TableCell cell11 = new TableCell(doc);
   cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text"));
   row1.AppendChildLast(cell11);
   TableRow row2 = new TableRow(doc);
   TableCell cell21 = new TableCell(doc);
   cell21.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Long text with several words and spaces."));
   row2.AppendChildLast(cell21);
   Table table = new Table(doc)
   {
       IsBordersVisible = true,
       Columns = { new TableColumn { Width = 70, LockedWidth = true } }
   };
   table.AppendChildLast(row1);
   table.AppendChildLast(row2);
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   outlineElem.AppendChildLast(table);
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "CreateTableWithLockedColumns_out.one";
   doc.Save(dataDir);

Mostra cómo crear una nueva tabla.

string dataDir = RunExamples.GetDataDir_Tables();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   TableRow row1 = new TableRow(doc);
   TableCell cell11 = new TableCell(doc);
   TableCell cell12 = new TableCell(doc);
   TableCell cell13 = new TableCell(doc);
   cell11.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.1"));
   cell12.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.2"));
   cell13.AppendChildLast(GetOutlineElementWithText(doc, "cell_1.3"));
   row1.AppendChildLast(cell11);
   row1.AppendChildLast(cell12);
   row1.AppendChildLast(cell13);
   TableRow row2 = new TableRow(doc);
   TableCell cell21 = new TableCell(doc);
   TableCell cell22 = new TableCell(doc);
   TableCell cell23 = new TableCell(doc);
   cell21.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.1"));
   cell22.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.2"));
   cell23.AppendChildLast(GetOutlineElementWithText(doc, "cell_2.3"));
   row2.AppendChildLast(cell21);
   row2.AppendChildLast(cell22);
   row2.AppendChildLast(cell23);
   Table table = new Table(doc)
   {
       IsBordersVisible = true,
       Columns =
       {
           new TableColumn { Width = 200 },
           new TableColumn { Width = 200 },
           new TableColumn { Width = 200 }
       }
   };
   table.AppendChildLast(row1);
   table.AppendChildLast(row2);
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   outlineElem.AppendChildLast(table);
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "InsertTable_out.one";
   doc.Save(dataDir);

Constructors

Título ( )

public TableCell()
   {
   }

Properties

BackgroundColor

Obtenga o establece el color de fondo.

public Color BackgroundColor
   {
      get;
      set;
   }

Valor de la propiedad

Color

Examples

Mostra cómo definir un color de fondo para una célula.

Document doc = new Document();
   TableCell cell11 = new TableCell(doc);
   cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text"));
   cell11.BackgroundColor = Color.Coral;
   TableRow row = new TableRow(doc);
   row.AppendChildLast(cell11);
   Table table = new Table(doc)
   {
       IsBordersVisible = true,
       Columns = { new TableColumn() { Width = 200 } }
   };
   table.AppendChildLast(row);
   OutlineElement oe = new OutlineElement(doc);
   oe.AppendChildLast(table);
   Outline o = new Outline(doc);
   o.AppendChildLast(oe);
   Page page = new Page(doc);
   page.AppendChildLast(o);
   doc.AppendChildLast(page);
   doc.Save(Path.Combine(RunExamples.GetDataDir_Tables(), "SettingCellBackGroundColor.pdf"));

LastModifiedTime

Obtenga o establece el último tiempo modificado.

public DateTime LastModifiedTime
   {
      get;
      set;
   }

Valor de la propiedad

DateTime

MaxWidth

Tiene el máximo de amplitud.

public float MaxWidth
   {
      get;
   }

Valor de la propiedad

float

Methods

Acceptado (DocumentVisitor)

Acepta al visitante del nodo.

public override void Accept(Aspose.Words.DocumentVisitor visitor)
   {
   }

Parameters

visitor DocumentVisitor

El objeto de una clase derivado del Aspose.Note.DocumentVisitor.

 Español