Introduced with 4D v19 R8, text boxes allow you to insert text, tables, images, formulas, and other elements anywhere into your applications. This feature has been improved in v20 to include the ability to export and import these elements from and to docx documents.
In addition, a new export option has been added that is also valid for other document types!
4D Write Pro & Text Boxes: docx Import/Export Options
Import
Before 4D Write Pro supported text boxes, it was possible to define how text boxes in docx documents should be imported. By default, the content of the text boxes was imported “in line.” They lost their formatting, but at least the content was preserved.
Good news: When importing, text boxes are imported as they are thanks to a new option, wk anchored, which becomes the default option!
// If you set this option, then text boxes will not be imported
$options.anchoredTextAreas:="ignore"
// If you set this option, then text boxes content will be imported as inline text
// This WAS the default value BEFORE 4D v20
$options.anchoredTextAreas:="inline"
// Since 4D v20, there is a new value that allows to import text boxes "as it"
// Note: this IS the NEW default value!
$options.anchoredTextAreas:="anchored" // textboxes are imported as textboxes
WParea2:=WP Import document($file.platformPath; $options)
Export
Like background colors or pictures used in documents, text boxes are considered parts of the background. For some reason, if you need to export your 4D Write Pro documents without their text boxes, just ignore the background when exporting.
This is possible using programming…
$options[wk visible background and anchored elements]:=false
WP EXPORT DOCUMENT(WParea; $path; wk docx; $options)
… or using the interface
CONCLUSION
This feature allows nicer document creation and compatibility to import and export docx documents. Let us know what you think about the 4D Forum!