Add combo box field to table cell

I’m trying to add a comboboxfield to a table cell, but receiving nullexception error. I don’t think I’m instantiating the comboboxfield correctly, but can’t seem to find any examples to apply to what I’m doing.



I’ve attached the source code showing how I’m creating the table, rows and cells. I create the header row declaratively, then loop a data returned from sql datareader to build the data rows.



Thank you.

Hi Jason,


Thanks for using our API’s.

I
have tested the scenario and I am able to reproduce the same problem that when trying to add ComboBoxField to PDF document (either in table or main page body). For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-38707. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.

Thank you for your reply. This seems to be possible using Aspose.Pdf.Generator class. However, I don’t seem to be able to mix objects created with Aspose.Pdf with objects created with Aspose.Pdf.Generator. For example, I can’t add an Aspose.Pdf.Generator.FormField to an Aspose.Pdf.BaseParagraph (cell.Paragraphs.Add).

Can you please explain the different recommended usages for Aspose.Pdf.Generator versus Aspose.Pdf? I’ve managed to create our entire pdf form using Aspose.Pdf with the exception of the combo box field. Should I have used Aspose.Pdf.Generator instead?

Hi Jason,


Thanks for your feedback. Please note you need to set combo box width to resolve the exception issue. Please try following code snippet for the purpose.

Moreover, in reference to use of Aspose.Pdf.Generator(old generator) and Aspose.Pdf(new generator). New generator is more efficient and removed, It can be used for generating a new PDF document from scratch and to manipulate existing PDF as well. We are not making any fix or enhancement in old generator but in new generator. Old generator will be obsolete in near future. So it is recommended to use new generator instead of old generator.

'add combo box<o:p></o:p>

Dim ATcomboBox As New Aspose.Pdf.InteractiveFeatures.Forms.ComboBoxField()

ATcomboBox.PartialName = String.Format("{0}_cc_ddl", analysesCnt)

ATcomboBox.Width = 50

ATcomboBox.Name = "ComboBoxField"

ATcomboBox.AddOption("Collected")

ATcomboBox.AddOption("Insufficient Volume")

ATcomboBox.AddOption("Not Required")

Best Regards,