Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
AddListItemメソッドを使用すると、ListBoxフィールドにアイテムを追加できます。最初の引数はフィールド名で、2番目の引数はフィールドアイテムです。単一のフィールドアイテムを渡すことも、アイテムのリストを含む文字列の配列を渡すこともできます。このメソッドは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から特定のアイテムを削除できます。最初のパラメータはフィールド名で、2番目のパラメータはリストから削除したいアイテムです。このメソッドは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.