Last active
September 22, 2015 22:25
-
-
Save bjoerntx/1b2463754bc41279b76f 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
/******************************************************** | |
* ProcessCheckboxFields method | |
* desc: Sets the Unicode characters for all | |
* checkbox fields | |
* parameter: document - the document in the internal | |
* Text Control format | |
********************************************************/ | |
private byte[] ProcessCheckboxFields(byte[] document) | |
{ | |
// create a new temporary ServerTextControl | |
using (TXTextControl.ServerTextControl tx = | |
new TXTextControl.ServerTextControl()) | |
{ | |
// load the document | |
tx.Create(); | |
tx.Load(document, | |
TXTextControl.BinaryStreamType.InternalUnicodeFormat); | |
// loop through all ApplicationFields | |
foreach (IFormattedText textPart in tx.TextParts) | |
{ | |
foreach (ApplicationField field in textPart.ApplicationFields) | |
{ | |
if ((field.TypeName != "FORMCHECKBOX")) | |
return null; | |
// create a new adapter field | |
FormCheckBox checkboxField = new FormCheckBox(field); | |
// select the field to change the font name | |
textPart.Selection.Start = checkboxField.Start - 1; | |
textPart.Selection.Length = checkboxField.Length; | |
textPart.Selection.FontName = "Arial Unicode MS"; | |
// set the text (state) | |
checkboxField.Text = | |
checkboxField.Checked == true ? CHECKED : UNCHECKED; | |
} | |
} | |
tx.Save(out document, BinaryStreamType.InternalUnicodeFormat); | |
return document; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment