public class RadioButton extends Paragraph
Represents a radiobutton item in a radiobutton field.
[C#] //Instantiate the Pdf document and add a section to it Pdf pdf1 = new Pdf(); Section sec1 = pdf1.Sections.Add(); //Create a table, set its column widths and add it to paragraphs collection //of the section Table tab1 = new Table(); tab1.ColumnWidths = "120 120 120"; sec1.Paragraphs.Add(tab1); //Add a row to the table Row r1 = tab1.Rows.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.Cells.Add("item1"); c1.Padding.Left = 30; c1.Paragraphs[0].ID = "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.Cells.Add("item2"); c2.Padding.Left = 30; c2.Paragraphs[0].ID = "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.Cells.Add("item3"); c3.Padding.Left = 30; c3.Paragraphs[0].ID = "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.FormFieldType = FormFieldType.RadioButton; radio.FieldName = "ARadio"; radio.ButtonColor = System.Drawing.Color.FromName("Red"); radio.RadioButtonCheckedIndex = 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.RadioButtons.Add(); bt1.ButtonHeight = 12; bt1.ButtonWidth = 12; bt1.PositioningType = PositioningType.ParagraphRelative; bt1.ReferenceParagraphID = "text1"; bt1.Left = -20; bt1.Top = 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.RadioButtons.Add(); bt2.ButtonHeight = 12; bt2.ButtonWidth = 12; bt2.PositioningType = PositioningType.ParagraphRelative; bt2.ReferenceParagraphID = "text2"; bt2.Left = -20; bt2.Top = 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.RadioButtons.Add(); bt3.ButtonHeight = 12; bt3.ButtonWidth = 12; bt3.PositioningType = PositioningType.ParagraphRelative; bt3.ReferenceParagraphID = "text3"; bt3.Left = -20; bt3.Top = 0; //Add the radio form field to the paragraphs collection of the section sec1.Paragraphs.Add(radio); //Save the Pdf pdf1.Save(...); [Visual Basic] 'Instantiate the Pdf document and add a section to it Dim pdf1 As Pdf = New Pdf Dim sec1 As Section = pdf1.Sections.Add() 'Create a table, set its column widths and add it to paragraphs collection 'of the section Dim tab1 As Table = New Table tab1.ColumnWidths = "120 120 120" sec1.Paragraphs.Add(tab1) 'Add a row to the table Dim r1 As Row = tab1.Rows.Add() 'Add 1st cell to the row, set its padding and set the ID of the first paragraph in the cell to "text1" Dim c1 As Cell = r1.Cells.Add("item1") c1.Padding.Left = 30 c1.Paragraphs(0).ID = "text1" 'Add 2nd cell to the row, set its padding and set the ID of the first paragraph in the cell to "text2" Dim c2 As Cell = r1.Cells.Add("item2") c2.Padding.Left = 30 c2.Paragraphs(0).ID = "text2" 'Add 3rd cell to the row, set its padding and set the ID of the first paragraph in the cell to "text3" Dim c3 As Cell = r1.Cells.Add("item3") c3.Padding.Left = 30 c3.Paragraphs(0).ID = "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 Dim radio As FormField = New FormField radio.FormFieldType = FormFieldType.RadioButton radio.FieldName = "ARadio" radio.ButtonColor = System.Drawing.Color.FromName("Red") radio.RadioButtonCheckedIndex = 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". Dim bt1 As RadioButton = radio.RadioButtons.Add() bt1.ButtonHeight = 12 bt1.ButtonWidth = 12 bt1.PositioningType = PositioningType.ParagraphRelative bt1.ReferenceParagraphID = "text1" bt1.Left = -20 bt1.Top = 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". Dim bt2 As RadioButton = radio.RadioButtons.Add() bt2.ButtonHeight = 12 bt2.ButtonWidth = 12 bt2.PositioningType = PositioningType.ParagraphRelative bt2.ReferenceParagraphID = "text2" bt2.Left = -20 bt2.Top = 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". Dim bt3 As RadioButton = radio.RadioButtons.Add() bt3.ButtonHeight = 12 bt3.ButtonWidth = 12 bt3.PositioningType = PositioningType.ParagraphRelative bt3.ReferenceParagraphID = "text3" bt3.Left = -20 bt3.Top = 0 'Add the radio form field to the paragraphs collection of the section sec1.Paragraphs.Add(radio) 'Save the Pdf pdf1.Save("e:/temp/test.pdf") [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>
Paragraph.VerticalPositionInfo
absolutePosX, absolutePosY, ClippingArea, FixedHeight, FixedWidth, isAbsoluteLayout, isFixedLayout, IsNeedAddToPage, IsPositionGot, IsPositionProcessed, isRelativeLayout, MayNeedReprocess, NextParagraph, posBottom, posLeft, posRight, posTop, RefPara, relativePosX, relativePosY, VerticalPosInfo
Constructor and Description |
---|
RadioButton()
Initializes a new instance of the
RadioButton class. |
Modifier and Type | Method and Description |
---|---|
Object |
completeClone() |
Object |
deepClone() |
float |
getButtonHeight()
Gets or sets a float value that indicates the height of the RadioButton.
|
float |
getButtonWidth()
Gets or sets a float value that indicates the width of the RadioButton.
|
boolean |
isSizeSet() |
void |
setButtonHeight(float value) |
void |
setButtonWidth(float value) |
copyTo, getBookmarked, getComposer, getFootNoteProcessed, getHeight, getID, getLeft, getMargin, getNeedReprocess, getNextParagraphInHeading, getPageNumber, getParentCell, getPositioningType, getPosX, getPosY, getRealPageNumber, getReferencedParagraphWidth, getReferenceParagraphID, getRefPageNumber, getSection, getTop, getWidth, isDisabled, isDisabled, isEndNote, isFirstParagraph, isFirstParagraph, isFirstParagraphInColumn, isFirstParagraphInColumn, isFootNote, isFootNote, isInHeaderFooter, isInHeaderFooter, isInList, isInList, isKeptTogether, isKeptTogether, isKeptWithNext, isKeptWithNext, isOnOddPage, isOnOddPage, setBookmarked, setFootNoteProcessed, setHeight, setID, setLeft, setMargin, setNeedReprocess, setNextParagraphInHeading, setPageNumber, setParentCell, setParentIsTable, setPositioningType, setPosX, setPosY, setRealPageNumber, setReferencedParagraphWidth, setReferenceParagraphID, setRefPageNumber, setSection, setTop, setWidth
public RadioButton()
Initializes a new instance of the RadioButton
class.
public boolean isSizeSet()
public float getButtonWidth()
Gets or sets a float value that indicates the width of the RadioButton. Default value is 100 points.
public void setButtonWidth(float value)
public float getButtonHeight()
Gets or sets a float value that indicates the height of the RadioButton. Default value is 100 points.
public void setButtonHeight(float value)
public Object completeClone()
completeClone
in class Paragraph
public Object deepClone()
Copyright © 2016 Aspose. All Rights Reserved.