Created
October 25, 2024 13:03
-
-
Save bjoerntx/5a0c8e4f1f037727896cb3d7d4c6f19c 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 (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) | |
{ | |
tx.Create(); | |
// Add a paragraph to the document | |
TXTextControl.Selection selection = new TXTextControl.Selection(0, 0); | |
selection.Text = "Hello Office Open XML!"; | |
// Set the paragraph format | |
selection.ParagraphFormat = new ParagraphFormat() | |
{ | |
Alignment = HorizontalAlignment.Center, | |
BackColor = System.Drawing.Color.LightGray, | |
Frame = Frame.BottomLine, | |
FrameLineColor = System.Drawing.Color.Red, | |
FrameStyle = FrameStyle.Double, | |
FrameLineWidth = 10 | |
}; | |
// Set the font format | |
selection.FontSize = 240; // 240 twips = 12 pt | |
selection.FontName = "Arial"; | |
selection.Bold = true; | |
// Apply the changes to the document | |
tx.Selection = selection; | |
// Save the document | |
tx.Save("results.docx", TXTextControl.StreamType.WordprocessingML); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment