Coder Social home page Coder Social logo

Nested conditions about docxtemplater HOT 4 CLOSED

Kolis121 avatar Kolis121 commented on September 27, 2024
Nested conditions

from docxtemplater.

Comments (4)

edi9999 avatar edi9999 commented on September 27, 2024

Hello @Kolis121 ,

Can you please send me your template (in docx format), data + code so that I can reproduce the issue.

It seems that your loops are never closed in your sample.

from docxtemplater.

edi9999 avatar edi9999 commented on September 27, 2024

I'm closing this since there's not much I can do without more information.

from docxtemplater.

Kolis121 avatar Kolis121 commented on September 27, 2024

Sorry, I got stuck with some other stuff...
Please find attached the Word file I tested back then.

I just wanted to replicate this issue to be sure, but I realized I have another error "Error: Scope parser execution failed" - I used the ExpressionParser you used in #717. I guess this Expression Parser you used cannot handle the conditions in the tag.

nestedconditions.docx

from docxtemplater.

edi9999 avatar edi9999 commented on September 27, 2024

Are you using following code :

const expressionParser = require("docxtemplater/expressions-ie11.js");
const doc = new Docxtemplater(zip, { parser: function(tag) {
   return { 
            get: function(scope, context) {
                  const result = expressionParser(tag).get(scope, context);
                  return result;
            }
   }
}});
doc.render(tags);

If yes, please make sure that you are using the latest docxtemplater (3.37.8)

If this still happens, please try the following and report back the new logs :

const expressionParser = require("docxtemplater/expressions-ie11.js");
const doc = new Docxtemplater(zip, { 
                 parser: function(tag) {
 				return {
					get (scope, context) {
						try {
							const result = expressionParser(tag).get(scope, context);
							return result;
						} catch (e) {
							console.log(e.message);
							console.log(e.stack);
							throw e;
						}
					},
				};
			},

});
doc.render(tags);

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.