Issue in Docx from Dynamic template

Certified Associate Developer

Hello,

I am using DocxFromDynamitecTemplate smart service for generating the dynamic table in  Docx file from given template.

but i am getting the only column names, data is not populating in the table.

Here is the xml data that i am passing  in a script task.

concat(
    "<info><row><name>",
   toHtml("John Samuael"),
    "</name><branch>",
tohtml("CSE"),
      "</branch><rollNo>",
    toHtml("abc"),
    "</rollNo>
	</row><row><name>",
   toHtml("Michelle Dsouza"),
    "</name><branch>",
tohtml("IT"),
      "</branch><rollNo>",
    toHtml("fgh"),
    "</rollNo>
	</row></info>"
  )

Template file:Test_Template_new.docx

generated file:

Generated dynamic document11122019 (2).docx

Process model:

Please suggest some solution,for dynamic row generation in table in document or suggest any alternate for this.

  Discussion posts and replies are publicly visible

Parents
  • Hello anupriyak0002 - Pass the below code as an expression rule to the 'Xml Data Model' field in the smart service. I have attached the template and the generated document as well. Please let me know if this works.

    a!localVariables(
      local!data: {
        {
          name: "John Samuael",
          branch: "CSE",
          rollNum: "abc"
        },
        {
          name: "Michelle Dsouza",
          branch: "IT",
          rollNum: "fgh"
        }
      },
      concat(
        "<info>",
        a!forEach(
          items: local!data,
          expression: "<rowvalues name = " & "'" & fv!item.name & "'" & " branch= " & "'" & fv!item.branch & "'" & " rollNum= " & "'" & fv!item.rollNum & "'" & " />"
        ),
        "</info>"
      )
    )

    Template :  0451.Template.docx

    Generated File : 6708.Generated File.docx

Reply
  • Hello anupriyak0002 - Pass the below code as an expression rule to the 'Xml Data Model' field in the smart service. I have attached the template and the generated document as well. Please let me know if this works.

    a!localVariables(
      local!data: {
        {
          name: "John Samuael",
          branch: "CSE",
          rollNum: "abc"
        },
        {
          name: "Michelle Dsouza",
          branch: "IT",
          rollNum: "fgh"
        }
      },
      concat(
        "<info>",
        a!forEach(
          items: local!data,
          expression: "<rowvalues name = " & "'" & fv!item.name & "'" & " branch= " & "'" & fv!item.branch & "'" & " rollNum= " & "'" & fv!item.rollNum & "'" & " />"
        ),
        "</info>"
      )
    )

    Template :  0451.Template.docx

    Generated File : 6708.Generated File.docx

Children