Created
September 30, 2024 14:52
-
-
Save bjoerntx/7c0f5d09532bf6c64eeca9ceb9ec364b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using TXTextControl; | |
using (ServerTextControl tx = new ServerTextControl()) | |
{ | |
tx.Create(); | |
// reusing the table cell format | |
TableCellFormat tableCellFormat = new TableCellFormat() | |
{ | |
BottomBorderWidth = 1, | |
TopBorderWidth = 1, | |
LeftBorderWidth = 1, | |
RightBorderWidth = 1 | |
}; | |
// add a table | |
tx.Tables.Add(5, 5, 10); | |
Table table = tx.Tables.GetItem(10); | |
// select first cell | |
table.Cells[1, 1].Select(); | |
tx.Selection.Length = 0; | |
// insert a nested table | |
tx.Tables.Add(2, 2); | |
// set text in nested table | |
foreach (TableCell cell in table.NestedTables[1].Cells) | |
{ | |
cell.Text = "nested"; | |
cell.CellFormat = tableCellFormat; | |
} | |
// set text and format in main table | |
foreach (TableCell cell in table.Cells) | |
{ | |
if (cell.Text == "") | |
cell.Text = "main"; | |
cell.CellFormat = tableCellFormat; | |
} | |
tx.Save("results.pdf", StreamType.AdobePDF); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment