DOCX from Dynamic Template issue

Certified Associate Developer

Hello,

I'm trying to generate document from XML code, I'm able to get the expected data if the data was single dictionary, but i have a requirement to generate document for a list of data items.

I have already seen many of the community posts, I followed the same pattern to generate doc using xml code, but I'm getting an error, says that syntax error in template.

Please let me know what i have done wrong here.

ERROR: Syntax error in template "fr.opensagres.xdocreport.document.docx.DocxReport@3ad77c4f!word/document.xml" in line 4, column 1468:
Encountered "\" \\b @before-row</w:t></w:r><w:r><w:rPr><w:noProof/></w:rPr><w:t>${d.@name}</w:t></w:r><w:r><w:rPr><w:noProof/></w:rPr><w:t>[/#list] \\b @after-row</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:w=\"", but was expecting pattern:
<ID>

I have shared the XML code and the template as well.


a!localVariables(
  local!data: {
    {
      name: "Sam",
      branch: "CSE",
      rollNum: "12301"
    },
    {
      name: "John",
      branch: "ECE",
      rollNum: "12302"
    }
  },
  concat(
    "<info>",
    a!forEach(
      items: local!data,
      expression: "<rowvalues name = " & "'" & fv!item.name & "'" & " branch= " & "'" & fv!item.branch & "'" & " rollNum= " & "'" & fv!item.rollNum & "'" & " />"
    ),
    "</info>"
  )
)
test doc_v2.docx

Thank you

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data