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
textControl1.Tables.Add(9, 9, 10);
Table table = textControl1.Tables.GetItem(10);
table.Select(2, 2, 4, 6);
FormatSelectedTableCells(new TableCellFormat()
{
BackColor = Color.LightGray,
BottomBorderWidth = 1,
});
textControl1.Tables.Add(9, 9, 10);
Table table = textControl1.Tables.GetItem(10);
table.Select(2, 2, 4, 6);
private void FormatSelectedTableCells(TableCellFormat cellFormat)
{
Table table = textControl1.Tables.GetItem();
if (table == null)
return;
Selection curSelection = new Selection(
textControl1.Selection.Start,
textControl1.Selection.Length);
string url = "https://www.textcontrol.com/img/corporate_id/tx_logo.svg";
using (WebClient client = new WebClient())
{
byte[] bytes = client.DownloadData(url);
using (MemoryStream ms = new MemoryStream(
bytes, 0, bytes.Length, writable: false, publiclyVisible: true))
{
// create image object
string imagePath = "Images/signature1.jpg";
byte[] bytes = File.ReadAllBytes(imagePath);
using (MemoryStream ms = new MemoryStream(
bytes, 0, bytes.Length, writable: false, publiclyVisible: true))
{
// create image object
TXTextControl.Image myImage = new TXTextControl.Image(ms);
textControl1.Images.Add(myImage, -1);
string imagePath = "Images/signature1.jpg";
// load image into memory stream
MemoryStream ms = new MemoryStream();
Image img = Image.FromFile(imagePath);
img.Save(ms, img.RawFormat);
// create image object
TXTextControl.Image myImage = new TXTextControl.Image(ms);
string imagePath = "Images/signature1.jpg";
System.Drawing.Image img = System.Drawing.Image.FromFile(imagePath);
TXTextControl.Image myImage = new TXTextControl.Image(img);
textControl1.Images.Add(myImage, -1);
string imagePath = "Images/signature1.jpg";
TXTextControl.Image myImage = new TXTextControl.Image() {
FileName = imagePath };
textControl1.Images.Add(myImage, -1);
public DocumentComparison(TXTextControl.TextControl originalDocument, TextControl revisedDocument)
{
// Initialize document references
m_originalDocument = originalDocument;
m_revisedDocument = revisedDocument;
// Enable track changes in the original document
originalDocument.IsTrackChangesEnabled = true;
// Compare paragraphs between the original and revised documents
private static List<(string word, int charIndex, string replacedWord)> CompareSentences(string sentence1, string sentence2)
{
string[] words1 = sentence1.Split(' ');
string[] words2 = sentence2.Split(' ');
List<(string word, int charIndex, string replacedWord)> differences =
new List<(string word, int charIndex, string replacedWord)>();
// Track the character index
int charIndex = 0;