Created
January 30, 2023 15:33
-
-
Save bjoerntx/3b7183f9c5f269996e96c02615160931 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
function jsInsertTable(rows, cols, id) { | |
TXTextControl.tables.add(rows, cols, id, function(e) { | |
if (e === true) { // if added | |
TXTextControl.tables.getItem(function(table) { | |
table.cells.forEach(function(cell) { | |
cell.setText("Cell text"); | |
}); | |
}, null, 10); | |
} | |
}) | |
} | |
function jsAddMergeField(text, name) { | |
TXTextControl.applicationFields.add( | |
TXTextControl.ApplicationFieldFormat.MSWord, | |
"MERGEFIELD", | |
text, | |
[name], | |
af => { | |
var highlightColor = "rgba(9, 165, 2, 0.3)"; | |
var highlightMode = TXTextControl.HighlightMode.Always; | |
af.setHighlightColor(highlightColor); | |
af.setHighlightMode(highlightMode); | |
af.setDoubledInputPosition(true); | |
} | |
); | |
} | |
function jsSetMergeFieldText(text) { | |
TXTextControl.applicationFields.forEach(function(appField) { | |
appField.setText(text); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment