Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
تسمح لك طريقة AddListItem بإضافة عنصر في حقل ListBox. الحجة الأولى هي اسم الحقل والحجة الثانية هي عنصر الحقل. يمكنك إما تمرير عنصر حقل واحد أو يمكنك تمرير مصفوفة من السلاسل تحتوي على قائمة من العناصر. يتم توفير هذه الطريقة بواسطة فئة FormEditor. يوضح لك مقتطف الكود التالي كيفية إضافة عناصر قائمة في ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddListItem()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of FormEditor to manipulate form fields
using (var formEditor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
formEditor.BindPdf(dataDir + "Sample-Form-01.pdf");
// Add a ListBox field for selecting country, placed at the specified coordinates on page 1
formEditor.AddField(Aspose.Pdf.Facades.FieldType.ListBox, "Country", 1, 232.56f, 476.75f, 352.28f,
514.03f);
// Add list items to the 'Country' ListBox field
formEditor.AddListItem("Country", "USA");
formEditor.AddListItem("Country", "Canada");
formEditor.AddListItem("Country", "France");
formEditor.AddListItem("Country", "Spain");
// Save PDF document
formEditor.Save(dataDir + "Sample-Form-01-mod.pdf");
}
}
تسمح لك طريقة DelListItem بحذف عنصر معين من ListBox. المعامل الأول هو اسم الحقل بينما المعامل الثاني هو العنصر الذي تريد حذفه من القائمة. يتم توفير هذه الطريقة بواسطة فئة FormEditor. يوضح لك مقتطف الكود التالي كيفية حذف عنصر قائمة من ملف PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void DelListItem()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf();
// Create an instance of FormEditor to manipulate form fields
using (var formEditor = new Aspose.Pdf.Facades.FormEditor())
{
// Bind PDF document
formEditor.BindPdf(dataDir + "Sample-Form-04.pdf");
// Delete the list item "France" from the 'Country' ListBox field
formEditor.DelListItem("Country", "France");
// Save PDF document
formEditor.Save(dataDir + "Sample-Form-04-mod.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.