Skip to content

Question - render BOTH loop with multiple table rows AND placeholder replacements #776

Closed
@chebfarid

Description

I am experimenting with your excellent library inside a browser, and while I think I understood the basics correctly I am unable to resolve the following problem: my .docx template file contains both, normal text paragraphs with several placeholder tags and a simple table with loop tags for dynamic table rows/cells.
No problem with rendering just the text part

doc.render(
    {
	placeholder_1 : replacement_1,
        (...)
	placeholder_n : replacement_n,
    }
);

And no problem with just rendering the table data (using a JSON object)

doc.render(myTableData)

But I am unable to render them both in the same document. I tried all possible combinations like

doc.render(
	myTableData,
	{
		placeholder_1 : replacement_1,
                (...)
		placeholder_n : replacement_n,
	}
);

and others, but the output file contains always only one of the two elements correctly rendered, or the text block or the table, never both. I also tried to call doc.render( ) twice but (as I imagined) this does not work.
Is what I want to do even possible? Or am I just using the wrong syntax?

Thanks in advance for any hint.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions