Giter VIP home page Giter VIP logo

Comments (12)

edi9999 avatar edi9999 commented on July 24, 2024

Could you please also upload the generated, corrupt document ?

from docxtemplater.

edi9999 avatar edi9999 commented on July 24, 2024

Do you get the error even when you remove the image module from the modules array ?

from docxtemplater.

MikeJamesFalconDev avatar MikeJamesFalconDev commented on July 24, 2024

Here is the corrupted document: Document.zip

I would like to correct something, when I sent you the parameters used, I sent you something I had tried at one point where I was using Report1.docx, but that was incorrect. The document I am uploading now was created with these parameters:

build({
  dashboard: { label: 'Topology', value: '/d/e532a7f3-2126-49e2-8195-eabe98276b8f/topology'},
  panels:['Topology', 'Panel Title'],
  templateName: '/home/mike/win-shared/Report.dotx',
  tmpDir: './imgs/'
})

Thank you for your quick response.

from docxtemplater.

edi9999 avatar edi9999 commented on July 24, 2024

Last thing :

your file seems to be a dotx file, not a docx file.

I think Microsoft Word is very sensitive to file names.

Could you try by doing :

fs.writeFileSync("/home/mike/win-shared/Report_" + params.dashboard.label + "_" + formattedDate + ".dotx", buf, {flush:true, encoding:'utf8'});

from docxtemplater.

MikeJamesFalconDev avatar MikeJamesFalconDev commented on July 24, 2024

Do you get the error even when you remove the image module from the modules array ?

Yes

Last thing :

your file seems to be a dotx file, not a docx file.

I think Microsoft Word is very sensitive to file names.

Could you try by doing :

fs.writeFileSync("/home/mike/win-shared/Report_" + params.dashboard.label + "_" + formattedDate + ".dotx", buf, {flush:true, encoding:'utf8'});

I don't get this one. Why should the output file be dotx. dotx is a template format and I'm trying to generate a document not a template. What am I getting wrong?

from docxtemplater.

edi9999 avatar edi9999 commented on July 24, 2024

I've just analysed your file, and it seems that something is not correct on the image module part :

When I open the resulting docx (a docx file is a zip file, see https://stackoverflow.com/tags/docx/info)

I see :

        <wp:extent cx="NaN" cy="NaN"/>

This usually means that something was done incorrectly in the image module. I do not support this free version of the module, my paid version does not have this issue though : https://docxtemplater.com/modules/image/

from docxtemplater.

MikeJamesFalconDev avatar MikeJamesFalconDev commented on July 24, 2024

But why does it fail when I'm only replacing text? I tried it without the module and got the same error.

from docxtemplater.

edi9999 avatar edi9999 commented on July 24, 2024

About the dotx/docx format :

dotx is a format for creating a template, but not in the sense of a docxtemplater template.

See this : https://superuser.com/questions/1285415/difference-between-documents-with-docx-and-dotx-filename-extensions

Basically a dotx file can not be saved, you have to click "Save As".

Internally, dotx and docx also have an inner difference so if you have a dotx as an input, you have to have a dotx as the output.

from docxtemplater.

edi9999 avatar edi9999 commented on July 24, 2024

So as a summary, I think you've got two independent issues that both lead to a corruption :

  1. The dotx/docx thing : a dotx file has to be saved back as a dotx, and a docx to a docx
  2. The issue with the NaN caused by the image module.

from docxtemplater.

MikeJamesFalconDev avatar MikeJamesFalconDev commented on July 24, 2024

You are correct. Used a docx as input and output for text replacement and it worked properly.
Thanks for the clarification.
I'll evaluate the paid version of the image module. Where can I find the pricing scheme?

from docxtemplater.

edi9999 avatar edi9999 commented on July 24, 2024

See here : https://docxtemplater.com/pricing/

from docxtemplater.

MikeJamesFalconDev avatar MikeJamesFalconDev commented on July 24, 2024

Thank you very much for your help. I will check it out.

from docxtemplater.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.