open-xml-templating/docxtemplater

Open and edit a created document via webdav (Windows) creates additional rows in a table

graadrag opened this issue · 4 comments

Environment

  • Version of docxtemplater : 3.39.1
  • Used docxtemplater-modules : no special
  • Runner : node.js v14.21.3

How to reproduce my problem :

My template is the following : (Upload the docx file here inside github, which you have to name template.zip (github doesn't accept the docx extension))

With the following js file :

const fs = require('fs');
const Docxtemplater = require('docxtemplater');
const PizZip = require('pizzip');
const content = fs
    .readFileSync("./Sample-Document-Template.docx", "binary");

const zip = new PizZip(content);
const doc = new Docxtemplater(zip)

doc.render({
	tmp: [1,2,3,4]
});

const buf = doc.getZip()
             .generate({type:"nodebuffer"});

fs.writeFileSync("./Sample-Document-Template-result.docx",buf);
  • make the generated file available via a WebDav
  • edit (with WebDav) some text in the headline
  • Save the document

I would expect it to :

Result:
Sample-Document-Template-result.docx
Template:
Sample-Document-Template.docx

After edit document on windows with WebDAV and save:
Sample-Document-Template-result-after-save-webdav.docx

Only the text - CHANGE WITH WEBDAV was added, but after saving, additional
3 lines appeared in the table. (unwanted behavior)

Hint: This behavior occurs only under windows

Hello @graadrag ,

that is strange, I think this could maybe be due to the fact that the paragraph ids are repeated (and thus duplicates).

It would be quite complex to automatically change those (and also first we would need to make sure that it would fix the issue).

Hi @edi9999,

Thank you for your quick feedback

After changing the document offline and saving it, Word seems to repair the document itself and then the IDs are unique.

Sample-Document-Template-result-offline-change.docx

With kind regards

Would you have 1 hour time to debug this together ?

It could be on a video call, this week. Here are my availabilities :

https://calendly.com/coding-puffin/45min

Without any response, I will have to close this issue.

Are you availalble for a 45 min call ? See link above.