Created
February 8, 2021 20:24
-
-
Save bjoerntx/d7d743e064183e8cba22090102ee93d6 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 (ServerTextControl tx = new ServerTextControl()) | |
{ | |
tx.Create(); | |
// create a new selection range | |
Selection range = new Selection(); | |
range.Bold = true; | |
range.FontSize = 400; | |
range.Text = "This is a new paragraph\r\n"; | |
// insert the range to the document | |
tx.Selection = range; | |
// add a table | |
tx.Tables.Add(5, 5, 10); | |
foreach (TableCell cell in tx.Tables.GetItem(10).Cells) | |
{ | |
cell.Text = cell.Row.ToString() + ", " + cell.Column.ToString(); | |
} | |
// save the document as DOCX | |
tx.Save("test.docx", StreamType.WordProcessingML); | |
// save the document as PDF | |
tx.Save("test.pdf", StreamType.AdobePDF); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment