Skip to content

Instantly share code, notes, and snippets.

View bjoerntx's full-sized avatar
👨‍💻
Building web apps

Bjoern Meyer bjoerntx

👨‍💻
Building web apps
View GitHub Profile
using var tx = new ServerTextControl();
tx.Create();
tx.Text = """
This document contains RegEx styled text samples.
Contact:
Jane Doe (jane.doe@acme.com)
Support: support@contoso.io
tx.Selection.Start = h.Start;
tx.Selection.Length = h.Length;
tx.Selection.FormattingStyle = h.StyleName;
Start: p.Start + m.Index - 1
foreach (Paragraph p in tx.Paragraphs)
{
string pText = p.Text ?? string.Empty;
...
}
var style = new InlineStyle(def.Name);
ApplyStyleDefinition(style, def);
tx.InlineStyles.Add(style);
{
"name": "Email address",
"pattern": "\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b",
"inlineStyleName": "Email",
"priority": 20,
"startOffset": 0
}
using TXTextControl;
const string csvPath = "sample-data.csv";
const string pdfPath = "test.pdf";
using var tx = new ServerTextControl();
tx.Create();
var importer = new CsvToTextControlTableImporter();
for (int r = 0; r < dataRowCount; r++)
{
int targetRow = templateDataRow + r;
var record = records[dataStartRowIndexInRecords + r];
for (int c = 1; c <= columnCount; c++)
{
string value = (c - 1) < record.Count ? record[c - 1] : string.Empty;
table.Cells[targetRow, c].Text = value;
}
table.Cells[templateDataRow, 1].Select();
tx.Selection.Length = 0;
table.Rows.Add(TableAddPosition.After, dataRowCount - 1);
table.Rows[templateDataRow].CellFormat = new TableCellFormat()
{
BottomBorderWidth = 10,
TopBorderWidth = 10,
RightBorderWidth = 10,
LeftBorderWidth = 10
};