Open iulica opened 2 years ago
The rewrite code is split into 4 different classes: MailMerge - main API, handles the reading/writing of the docx ZIP file, the parts of the document, and also getting the fields from the xml MergeDocument - handles multi-document mail merges (separators, etc) MergeField - one data field, handles the data formatting for one field MergeData - factory for MergeField handles the merge of replacement data into one part (body)
The changes implement support for MERGE fields inside other fields, and formatting flags.
Description
Fields spanning several paragraphs are detected and proper integration with MERGEFIELDS values is implemented. Number and text formatting and flags are implemented. Support for date formatting is added, but not yet implemented. A framework for easier testing of formats is also added along with tests for all changes. Previous tests are also passed, although some tests are incorrect. For those tests a flag is implemented to be able to remove the workarounds for those tests after review. When documents with nested fields are created, these documents need to be updated, by selecting the whole document and pressing F9. There is a flag for auto-updating all fields when opening the document. Support for setting this flag is also added (no, always, auto). Default is no, for backward compatibility.
Motivation and Context
It allows using more complex documents, that have formatting and complex fields. Several issues are solved, mostly about using MERGEFIELDS inside other fields like IF or INCLUDEPICTURE.
102 #88 #80 #78 #60 #52 #40
How Has This Been Tested?
All the changes have their own tests.
Screenshots (if appropriate):
Types of changes
Checklist: