PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Modify PdfComboBoxField list values & value of the field
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4138
Page 1 of 1

Author:  nicolas.d [ Thu May 28, 2020 8:54 am ]
Post subject:  Modify PdfComboBoxField list values & value of the field

Hi,

I'm trying to fill a PDF form with PDFsharp and there is no problems for fields like PdfTextField or PdfCheckBoxField.
But i encounter two problems with the ComboBoxField :
- I don't understand how to modify (add, delete or modify) the list of the values available for the combo field.
- Setting the value doesn't seem to works (My example code is right below)

Code:
           
// Open the file
PdfDocument pdf = PdfReader.Open(pdfFilePath);

PdfComboBoxField comboBoxField = (PdfComboBoxField)(pdf.AcroForm.Fields["FRM_CRM1_Marque"]);

if (comboBoxField != null)
{
    comboBoxField.Value = new PdfString("Choice 1");
}

// Save the document...
pdf.Save(pdfFillFilePath);
pdf.Close();


Do you know if it is possible to solve my two problems and how please?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/