Skip to content

XLSX Module - how to loop in excel repeating a row, but only for a given set of columns ? #646

Open
@virendraworkmail

Description

@virendraworkmail

Environment

  • Version of docxtemplater : 3.29.0
  • Used docxtemplater-modules : docxtemplater-xlsx-module (V 3.9.3)
  • Runner : Node.JS - (16.13.0), NPM - (8.1.0)

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 content = fs
    .readFileSync(__dirname + "/template.zip", "binary");

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

doc.render({
	items: [{
            name: "First product",
            quantity: 1,
            unit_price: { type: "currency", value: 200 },
        },
        {
            name: "Other product",
            quantity: 3,
            unit_price: { type: "currency", value: 100 },
        }, {
            name: "Third product",
            quantity: 3,
            unit_price: { type: "currency", value: 100 },
        },
    ]
});

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

fs.writeFileSync(__dirname+"/output.docx",buf);

Generated Output -
gen_demo.xlsx

Used Template
demo_template.xlsx

I would expect it to :

it should not repeate the whole row. As I have other tables side by side.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions