Skip to content

Non-M2Doc fields are replaced by (typically wrong) fixed values during generation #466

@nheuermann

Description

@nheuermann

Note: I've added my findings already to #377, but they may not have been recognized on that already closed issue.

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please have a look to the support pages of our website : http://m2doc.org/support/

Current behavior

In my template, the field for the filename ({ FILENAME * MERGEFORMAT }) in the footer is replaced during generation by the actual value - by the template filename, not the filename of the generated document.

Expected behavior

Expectation is that the field stays intact without being replaced by a value by M2Doc (it's not starting with "m:", so M2Doc shouldn't alter it).

Minimal reproduction of the problem with instructions

Use the attached template file to generate the file (generated file also attached).
I played a bit around (we are using M2Doc 3.2.0 programmatically, but normal UI does show the same behaviour, below files are from that one) and saw that it very much depends on the template file itself:

  • Same fields are handled differently (replaced/not replaced) when copied into a fresh Word document (I've started with a fresh Word 356 document, just adding headers/footers, so it's not an "aged" template file with much stuff deleted).
  • The below is the "intermediate" case - my original file had both filename field as well as total number of pages {NUMPAGES * Arabic * MERGEFORMAT} replaced. Copied once into a new file resolved everything. Copied into another ended up with this case. EDIT: the "resolved everything" file now shows the same issues, both fields incorrectly replaced. No idea why
  • The filename field is only replaced on the second page, not on the first page (header/footer is different for first page compared to other pages)

Files:
M2Doc_PHA_Landscape.docx
M2Doc_PHA_Landscape.generated.docx

What is the motivation / use case for changing the behavior?

Apart from this example, we also see cases of replaced figure numbers etc. - a big problem, as these figure numbers are then all wrong and would have to be replaced manually by fields again after generation.

Environment


M2Doc version: 3.2.0
Eclipse version: programmatically used on medini 2022R1
Platform version:  Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions