TableCell.BackgroundColor

TableCell.BackgroundColor property

Ruft die Hintergrundfarbe ab oder legt sie fest.

public Color BackgroundColor { get; set; }

Beispiele

Zeigt, wie eine Hintergrundfarbe für eine Zelle festgelegt wird.

// Erstellen Sie ein Objekt der Document-Klasse
Document doc = new Document();

// Objekt der TableCell-Klasse initialisieren und Textinhalt festlegen
TableCell cell11 = new TableCell();
cell11.AppendChildLast(InsertTable.GetOutlineElementWithText(doc, "Small text"));
cell11.BackgroundColor = Color.Coral;

// TableRow-Klassenobjekt initialisieren
TableRow row = new TableRow();
row.AppendChildLast(cell11);

Table table = new Table()
              {
                  IsBordersVisible = true,
                  Columns = { new TableColumn() { Width = 200 } }
              };
table.AppendChildLast(row);

OutlineElement oe = new OutlineElement();
oe.AppendChildLast(table);

Outline o = new Outline();
o.AppendChildLast(oe);

// Seitenklassenobjekt initialisieren
Page page = new Page();
page.AppendChildLast(o);

doc.AppendChildLast(page);

doc.Save(Path.Combine(RunExamples.GetDataDir_Tables(), "SettingCellBackGroundColor.pdf"));

Siehe auch