cancel
Showing results for 
Search instead for 
Did you mean: 

Create pdf file dynamically using XML

Former Member
0 Kudos

Hi Experts,

I have a Webdynpro application where I want to print the data for 'N' number of employees using adobe interactive forms. I have designed the form for one employee. I want to use the same format for the rest of the employees. Can any body please guide me how to go about this.

Regards,

Abdullah

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

In your context , create a node <b>MasterNode</b> of cardinality <b>1...1</b> and <b>singleton</b> set to <b>true</b>. Bind this to the <b>dataSource</b> property of the <b>InteractiveFormElement</b>.

Inside this <b>MasterNode</b> create a node <b>Data</b> of cardinality <b>0...n</b> and <b>singleton</b> set to <b>false</b>. Keep all of your payslip attributes inside this node.

In your interactive form element , in the Body Page create a subform of Type <b>Flow Content</b> and Flow Direction <b>Table</b> .Check the chechbox for <b>Allow Page Breaks within Context</b> . Inside this subform create another subform of Type <b>Flow Content</b> and Flow Direction <b>Western Text</b> . Uncheck the checkbox for <b>Allow Page Breaks within Context</b> . Put all of your pay slip UI elements inside this subform and bind them with the attributes under the node Data. Also tick the property of the inner subform under the section Object->Subform that says <b>Repeat Subform for each Data Item</b>

In your view controller coding area , create an element of the node Data for each employee record and populate it with values for the particular employee .

Add all of the elements that you created into an ArrayList and bind this ArrayList to the node Data. Now your form is ready for n number of employees.

Put this sort of coding in your view controller coding:


IDataElement objData = null; 
ArrayList arlData = null; 
int intNumberOfEmployees=0; 

try 
{ 
        arlData = new ArrayList(); 
        intNumberOfEmployees = //Get size of your model node that returns employee info 
        if(intNumberOfEmployees>0) 
        { 
                for(int i=0;i<intNumberOfEmployees;i++) 
                { 
                        objData  = wdContext.createDataElement(); 
                        objData.setName("//Value fetched from backend here");//Eg:wdContext.nodeEmployeeInfo.getEmployeeInfoElementAt(i).getname() 
                        //Similarly set all of the values 
                        arlData.add(objData); 
                } 
        } 
        wdContext.nodeData.bind(arlData); 
}