Docx from Dynamic template

Certified Senior Developer

hi i want to create a template and xml data model for Docx from dynamic template. how to code that. and how to create the template. can i get an idea? 

it should be like letter. 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Hello  

    We can show some Ideas only if you give us more information.
    1. What is the content? 

    2. Will it contains tables or any other images?

    3.Does it have any dynamic content?

    4. What are the fields that will change or update dynamically?

  • 0
    Certified Senior Developer
    in reply to Konduru Chaitanya

    It should be like this. all the names, address, mobile number all those should be dynamic values. I want know how to config template and xml model for them

  • 0
    Certified Senior Developer
    in reply to thiliniumesha

    Your Word Template would look something in this way

    Do not want to provide the actual file since it would only affect your learning.

    You will have to pass the data using the varable. Your values in the doc will be defined in this format doc.VariableName.field .

    you will need to construct the data in a expression rule in the below format (Example). Please refer and write your own expression.

    = "<letter>" & 
    "<date>" & text(ri!letter.date,"yyyy-mm-dd") & "</date>" & 
    "<name>" & ri!letter.name"</name>" &
    /*other fields in a non ultiple variable*/
    
    a!forEach(
      items: ri!names/*Variable that contains the list of data in the Table*/,
      expression: "<names" & 
      " name=" & "'" & fv!item.name & "'" & 
      " lastName=" & "'" & fv!item.lastName & "'" &
      " mail=" & "'" & fv!item.mail & "'"&  
      " />"
    ) & "</letter>"

    Please do more research on how to write XML and DOCX template which would help you explore more ways of creating a dynamic doc

Reply
  • 0
    Certified Senior Developer
    in reply to thiliniumesha

    Your Word Template would look something in this way

    Do not want to provide the actual file since it would only affect your learning.

    You will have to pass the data using the varable. Your values in the doc will be defined in this format doc.VariableName.field .

    you will need to construct the data in a expression rule in the below format (Example). Please refer and write your own expression.

    = "<letter>" & 
    "<date>" & text(ri!letter.date,"yyyy-mm-dd") & "</date>" & 
    "<name>" & ri!letter.name"</name>" &
    /*other fields in a non ultiple variable*/
    
    a!forEach(
      items: ri!names/*Variable that contains the list of data in the Table*/,
      expression: "<names" & 
      " name=" & "'" & fv!item.name & "'" & 
      " lastName=" & "'" & fv!item.lastName & "'" &
      " mail=" & "'" & fv!item.mail & "'"&  
      " />"
    ) & "</letter>"

    Please do more research on how to write XML and DOCX template which would help you explore more ways of creating a dynamic doc

Children