We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Binding XML data to table (within a subform) in the XFA form not working

Hi, I am new to ASPOSE.Pdf. I have an XFA form that has multiple fields. There is also a table in a Subform in the Main. I have an XML data file that will populate the XFA form. Issue is that only fields that are directly under Main get populated, but any fields that are in a Subform within the Main are not being populated.

For example below get populated :

topmostSubform[0].Main[0].CLAIMNO[0]

But below does not get populated as it has a subForm in Main called “TopSubForm”:

topmostSubform[0].Main[0].TopSubForm[0].CLAIMNO[0]

Same is true for the table that is within a Subform (“ProviderSubForm”) in the Main. It does not get populated:

topmostSubform[0].Main[0].ProviderSubForm[0].Provider[0].Row1[0].PROVIDERNAME[0]

My code is something like this. Please let me know if there is a better way to do this.

string _formPath = @“XFATemplateFile.pdf”;
// Open document
Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form();
form.BindPdf(_formPath);

            // Open xml file.
            System.IO.FileStream xmlInputStream = new FileStream(@"TestDataFile.xml", FileMode.Open);

            // Import data
            form.ImportXml(xmlInputStream);
            
            // Close file stream
            xmlInputStream.Close();

            string _outFileLoc = @"OutputFile.pdf";
            // Save updated document
            form.Save(_outFileLoc);

@abhkumar

Would you please share your sample files with us so that we can test the scenario in our environment and address it accordingly.

I have uploaded two files :

  1. FormWithTable_Template.pdf : This is the XFA form.
  2. FormWithTable_data.xml : This is the data XML Form that need to bind to the Template Form.

Please provide code by which the Provider table within the Template file can be filled in using the XML file.

FormWithTable_Template.pdf (1.3 MB)
FormWithTable_Template.pdf (1.3 MB)
For_Aspose.zip (1.3 MB)

@abhkumar

We were able to notice the issue in our environment while testing the scenario with Aspose.PDF for .NET 20.7. Therefore, a ticket has been logged as PDFNET-48524 in our issue tracking system for it. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.