Comments (12)
Could you please also upload the generated, corrupt document ?
from docxtemplater.
Do you get the error even when you remove the image module from the modules array ?
from docxtemplater.
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.
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.
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.
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.
But why does it fail when I'm only replacing text? I tried it without the module and got the same error.
from docxtemplater.
About the dotx
/docx
format :
dotx
is a format for creating a template, but not in the sense of a docxtemplater template.
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.
So as a summary, I think you've got two independent issues that both lead to a corruption :
- The dotx/docx thing : a dotx file has to be saved back as a dotx, and a docx to a docx
- The issue with the NaN caused by the image module.
from docxtemplater.
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.
See here : https://docxtemplater.com/pricing/
from docxtemplater.
Thank you very much for your help. I will check it out.
from docxtemplater.
Related Issues (20)
- Cannot resolve @Name placeholder HOT 2
- Chart Module: Unexpected Behavior with Null Value in Data HOT 3
- Differentiate between conditions and loops when getting tags HOT 1
- Conditional assignment doesn't work as expected HOT 1
- Page break propogates to all elements inside div HOT 5
- Numbering for conditional text HOT 3
- Question: Importing ExpressionParser in TypeScript. HOT 6
- When I write a tag in complex content, it doesn't work HOT 4
- HTMLModule Dependencies causing errors HOT 1
- paragraphLoop doesn't seem to work HOT 2
- ChartModule + ErrorLocationModule HOT 2
- Bun.sh HOT 1
- Trying to setup angular parser, but is failing with compilation error. HOT 8
- getSize 返回一个promsie ,word预览正常,但是导出word图片丢失 HOT 2
- Compile (tsx) issue with TxtTemplater HOT 1
- Ability to Insert IDs into XML Tags HOT 1
- Slides demo is broken HOT 1
- Duplicate content of a word file (in one page) HOT 1
- Error: New Delimiters cannot be parsed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docxtemplater.