op.fields.modify

From PDF XChange PDF SDK
Jump to: navigation, search
(Automatic page editing by robot)
 
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
{{#customTitle:op.fields.modify}}
 
{{#customTitle:op.fields.modify}}
 
{{#parentPage:PXV:Operations|op.fields.modify|operation}}
 
{{#parentPage:PXV:Operations|op.fields.modify|operation}}
{{ToWrite}}
 
 
{{ToReview}}
 
{{ToReview}}
  
 
== Overview ==
 
== Overview ==
The operation overview...
+
The operation is used to modify form fields' values.
  
 
== Parameters ==
 
== Parameters ==
Line 16: Line 15:
 
| class="op_param_name" | Input
 
| class="op_param_name" | Input
 
| style="text-align:center" | Array
 
| style="text-align:center" | Array
| Array of <code>IUnknown</code>-based objects.
+
| Array of <code>IUnknown</code>-based objects containing the [[PXV:IPXC_FormField|form fields]] that need to be modified.
 
|-
 
|-
 
| class="op_param_name" | Output
 
| class="op_param_name" | Output
 
| style="text-align:center;" | Array
 
| style="text-align:center;" | Array
| Array of <code>IUnknown</code>-based objects.
+
| Is not used.
 
|-
 
|-
 
| class="op_param_name" | [[PXV:op_fields_modify_Options|Options]]
 
| class="op_param_name" | [[PXV:op_fields_modify_Options|Options]]
Line 26: Line 25:
 
| Dictionary with options of the operation.
 
| Dictionary with options of the operation.
 
|}
 
|}
 +
 +
== Sample ==
 +
<pre class="brush:c#">//C#
 +
PDFXEdit.IPXC_Document CreateNewDocument(out PDFXEdit.PXC_Rect rc)
 +
{
 +
PDFXEdit.IPXC_Document coreDoc = pxcInst.NewDocument();
 +
rc.left = 0;
 +
rc.right = 500;
 +
rc.top = 800;
 +
rc.bottom = 0;
 +
PDFXEdit.IPXC_UndoRedoData urd;
 +
coreDoc.Pages.AddEmptyPages(0, 1, ref rc, null, out urd);
 +
rc.left = 10;
 +
rc.right = 100;
 +
rc.top = 700;
 +
rc.bottom = 670;
 +
return coreDoc;
 +
}
 +
 +
private void SetComboBoxValue()
 +
{
 +
PDFXEdit.PXC_Rect rc;
 +
PDFXEdit.IPXC_Document coreDoc = CreateNewDocument(out rc);
 +
{
 +
PDFXEdit.IPXC_FormField ff = coreDoc.AcroForm.CreateField("ComboBox1", PDFXEdit.PXC_FormFieldType.FFT_ComboBox, 0, ref rc);
 +
ff.InsertOptRecord("Value1", "Label1");
 +
ff.InsertOptRecord("Value2", "Label2");
 +
ff.InsertOptRecord("Value3", "Label3");
 +
ff.InsertOptRecord("Value4", "Label4");
 +
}
 +
pdfCtl.OpenDocFrom(coreDoc);
 +
{
 +
PDFXEdit.IPXC_FormField ff = coreDoc.AcroForm.GetFieldByName("ComboBox1");
 +
int nID = pdfCtl.Inst.Str2ID("op.fields.modify", false);
 +
PDFXEdit.IOperation Op = pdfCtl.Inst.CreateOp(nID);
 +
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
 +
input.Add().v = ff;
 +
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
 +
PDFXEdit.ICabNode value = options["Value"];
 +
value["Selection"].Add().v = 2;
 +
options["Mask"].v = 0x00000100 | 0x00000800; // Value modification
 +
Op.Do();
 +
}
 +
}

Latest revision as of 01:48, 15 August 2017


Overview

The operation is used to modify form fields' values.

Parameters

Name Type Description
Input Array Array of IUnknown-based objects containing the form fields that need to be modified.
Output Array Is not used.
Options Dictionary Dictionary with options of the operation.

Sample

//C#
PDFXEdit.IPXC_Document CreateNewDocument(out PDFXEdit.PXC_Rect rc)
{
	PDFXEdit.IPXC_Document coreDoc = pxcInst.NewDocument();
	rc.left = 0;
	rc.right = 500;
	rc.top = 800;
	rc.bottom = 0;
	PDFXEdit.IPXC_UndoRedoData urd;
	coreDoc.Pages.AddEmptyPages(0, 1, ref rc, null, out urd);
	rc.left = 10;
	rc.right = 100;
	rc.top = 700;
	rc.bottom = 670;
	return coreDoc;
}

private void SetComboBoxValue()
{
	PDFXEdit.PXC_Rect rc;
	PDFXEdit.IPXC_Document coreDoc = CreateNewDocument(out rc);
	{
		PDFXEdit.IPXC_FormField ff = coreDoc.AcroForm.CreateField("ComboBox1", PDFXEdit.PXC_FormFieldType.FFT_ComboBox, 0, ref rc);
		ff.InsertOptRecord("Value1", "Label1");
		ff.InsertOptRecord("Value2", "Label2");
		ff.InsertOptRecord("Value3", "Label3");
		ff.InsertOptRecord("Value4", "Label4");
	}
	pdfCtl.OpenDocFrom(coreDoc);
	{
		PDFXEdit.IPXC_FormField ff = coreDoc.AcroForm.GetFieldByName("ComboBox1");
		int nID = pdfCtl.Inst.Str2ID("op.fields.modify", false);
		PDFXEdit.IOperation Op = pdfCtl.Inst.CreateOp(nID);
		PDFXEdit.ICabNode input = Op.Params.Root["Input"];
		input.Add().v = ff;
		PDFXEdit.ICabNode options = Op.Params.Root["Options"];
		PDFXEdit.ICabNode value = options["Value"];
		value["Selection"].Add().v = 2;
		options["Mask"].v = 0x00000100 | 0x00000800; // Value modification
		Op.Do();
	}
}