public class RadioButton extends Paragraph
Represents a radiobutton item in a radiobutton field.
[Java] //Instantiate the Pdf document and add a section to it Pdf pdf1 = new Pdf(); Section sec1 = pdf1.getSections().add(); //Create a table, set its column widths and add it to paragraphs collection //of the section Table tab1 = new Table(); tab1.setColumnWidths ( "120 120 120"); sec1.getParagraphs().add(tab1); //Add a row to the table Row r1 = tab1.getRows().add(); //Add 1st cell to the row, set its padding and set the ID of the first paragraph //in the cell to "text1" Cell c1 = r1.getCells().add("item1"); c1.getPadding().setLeft ( 30); c1.getParagraphs().get_Item(0).setID ( "text1"); //Add 2nd cell to the row, set its padding and set the ID of the first paragraph //in the cell to "text2" Cell c2 = r1.getCells().add("item2"); c2.getPadding().setLeft ( 30); c2.getParagraphs().get_Item(0).setID ( "text2"); //Add 3rd cell to the row, set its padding and set the ID of the first paragraph //in the cell to "text3" Cell c3 = r1.getCells().add("item3"); c3.getPadding().setLeft ( 30); c3.getParagraphs().get_Item(0).setID ( "text3"); //Create a form field of RadioButton type. Set its field name and button color. //Then set the index of the radio button value to be checked FormField radio = new FormField(); radio.setFormFieldType ( FormFieldType.RadioButton); radio.setFieldName ( "ARadio"0; radio.setButtonColor ( Color.fromName("Red")); radio.setRadioButtonCheckedIndex ( 0); //Create 1st radio button instance and add it to above created radio form field. //Set its width and height. The position of the radio button is set to be //relative to the paragraph. Link this radio button with the paragraph with ID //equal to "text1". RadioButton bt1 = radio.getRadioButtons().add(); bt1.setButtonHeight ( 12); bt1.setButtonWidth ( 12); bt1.setPositioningType ( PositioningType.ParagraphRelative); bt1.setReferenceParagraphID ( "text1"); bt1.setLeft ( -20); bt1.setTop ( 0); //Create 2nd radio button instance and add it to above created radio form field. //Set its width and height. The position of the radio button is set to be //relative to the paragraph. Link this radio button with the paragraph with ID //equal to "text2". RadioButton bt2 = radio.getRadioButtons().add(); bt2.setButtonHeight ( 12); bt2.setButtonWidth ( 12); bt2.setPositioningType ( PositioningType.ParagraphRelative); bt2.setReferenceParagraphID ( "text2"); bt2.setLeft ( -20); bt2.setTop ( 0); //Create 3rd radio button instance and add it to above created radio form field. //Set its width and height. The position of the radio button is set to be //relative to the paragraph. Link this radio button with the paragraph with ID //equal to "text3". RadioButton bt3 = radio.getRadioButtons().add(); bt3.setButtonHeight ( 12); bt3.setButtonWidth ( 12); bt3.setPositioningType ( PositioningType.ParagraphRelative); bt3.setReferenceParagraphID ( "text3"); bt3.setLeft ( -20); bt3.setTop ( 0); //Add the radio form field to the paragraphs collection of the section sec1.getParagraphs().add(radio); //Save the Pdf pdf1.save(...); [XML] <?xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf"> <Section> <Table ColumnWidths="120 120 120"> <Row> <Cell PaddingLeft="30"> <Text ID="text1"> <Segment>item1</Segment> </Text> </Cell> <Cell PaddingLeft="30"> <Text ID="text2"> <Segment>item2</Segment> </Text> </Cell> <Cell PaddingLeft="30"> <Text ID="text3"> <Segment>item3</Segment> </Text> </Cell> </Row> </Table> <FormField FormFieldType="RadioButton" RadioButtonCheckedIndex="0" FieldName="aRadioutton" ButtonColor="Red"> <RadioButton ButtonWidth="12" ButtonHeight="12" PositioningType="ParagraphRelative" ReferenceParagraphID="text1" Left="-20" Top="0"> </RadioButton> <RadioButton ButtonWidth="12" ButtonHeight="12" PositioningType="ParagraphRelative" ReferenceParagraphID="text2" Left="-20" Top="0"> </RadioButton> <RadioButton ButtonWidth="12" ButtonHeight="12" PositioningType="ParagraphRelative" ReferenceParagraphID="text3" Left="-20" Top="0"> </RadioButton> </FormField> </Section> </Pdf>
Modifier and Type | Field and Description |
---|---|
float |
ButtonHeight
Gets or sets a float value that indicates the height of the RadioButton.
|
float |
ButtonWidth
Gets or sets a float value that indicates the width of the RadioButton.
|
_PositioningType, FixedHeight, FixedWidth, ID, IsDisabled, IsFirstParagraph, IsFirstParagraphInColumn, IsInList, IsKeptTogether, IsKeptWithNext, IsOnOddPage, Left, Margin, ReferenceParagraphID, Top
Constructor and Description |
---|
RadioButton()
Initializes a new instance of the
RadioButton class. |
RadioButton(FormField parentFormField)
Initializes a new instance of the
RadioButton class. |
Modifier and Type | Method and Description |
---|---|
Object |
completeClone() |
Object |
deepClone() |
FormField |
getParentFormField()
returns instanse of FormField (if any), part of which this RadioButton is
|
void |
load(com.aspose.ms.System.Xml.XmlTextReader xmlReader,
LoadingContext context)
loads parameters of current instanse from legacy XML
|
copyTo, getBookmarked, setBookmarked
public float ButtonWidth
Gets or sets a float value that indicates the width of the RadioButton. Default value is 100 points.
public float ButtonHeight
Gets or sets a float value that indicates the height of the RadioButton. Default value is 100 points.
public RadioButton()
Initializes a new instance of the RadioButton
class.
public RadioButton(FormField parentFormField)
Initializes a new instance of the RadioButton
class.
public FormField getParentFormField()
returns instanse of FormField (if any), part of which this RadioButton is
public void load(com.aspose.ms.System.Xml.XmlTextReader xmlReader, LoadingContext context)
loads parameters of current instanse from legacy XML
load
in class XmlEntityWithInternals
public Object completeClone()
completeClone
in class Paragraph
public Object deepClone()
Copyright © 2014 Aspose. All Rights Reserved.