I am attempting to create a group of checkboxFields, where they are all on the same row and only one can be selected at a time. Currently we use the below approach to create the checkboxFields, however this results in each checkboxField being on its own row and group. How can I achieve multiple checkboxFields within a single group?
public void CreateCheckbox(SpecRow sr)
{
Aspose.Pdf.Page pdfPage = Doc.Pages[currentPage];
double bottomY = pdfPage.Rect.LLY;
double offset = 25;
if (lastY - offset - sr.Height < bottomY)
{
Doc.Pages.Add();
currentPage++;
pdfPage = Doc.Pages[currentPage];
lastY = pdfPage.Rect.URY;
}
Aspose.Pdf.Rectangle fldRect = new Aspose.Pdf.Rectangle(
pdfPage.Rect.LLX, // fieldLLX
lastY - offset - sr.Height, // fieldLLY // Height
pdfPage.Rect.LLX + sr.Width, // fieldURX, // Width
lastY - offset // fieldURY
);
CheckboxField checkBox = new CheckboxField(pdfPage, fldRect);
checkBox.PartialName = sr.Name; // Name
checkBox.DefaultAppearance.FontName = sr.Font; // Font
checkBox.DefaultAppearance.FontSize = sr.FontSize != null ? (double)sr.FontSize :
checkBox.DefaultAppearance.FontSize; // Font Size
checkBox.DefaultAppearance.TextColor = System.Drawing.Color.FromName(sr.TextColor); // Text Color
checkBox.AlternateName = sr.Tooltip; // Tooltip
if (!string.IsNullOrEmpty(sr.BorderColor))
{
checkBox.Border = new Aspose.Pdf.Annotations.Border(checkBox);
checkBox.Border.Style =
(Aspose.Pdf.Annotations.BorderStyle)Enum.Parse(typeof(Aspose.Pdf.Annotations.BorderStyle), sr.BorderStyle); // Border Style
checkBox.Border.Width = (int)sr.BorderThickness; // Border Thickness
checkBox.Characteristics.Border = System.Drawing.Color.FromName(sr.BorderColor); // Border Color
}
if (!string.IsNullOrEmpty(sr.FillColor))
{
checkBox.Characteristics.Background = System.Drawing.Color.FromName(sr.FillColor); // Fill Color
}
if (!string.IsNullOrEmpty(sr.ExportValue))
{
checkBox.Exportable = true;
checkBox.Value = sr.ExportValue;
checkBox.ExportValue = sr.ExportValue; // Export Value
}
checkBox.Characteristics.Rotate = (Aspose.Pdf.Rotation)Enum.Parse(typeof(Aspose.Pdf.Rotation), sr.Orientation); // Orientation
checkBox.Flags = !string.IsNullOrEmpty(sr.FormField) ?
(Aspose.Pdf.Annotations.AnnotationFlags)Enum.Parse(typeof(Aspose.Pdf.Annotations.AnnotationFlags), sr.FormField) :
checkBox.Flags; // Form Field
checkBox.TextHorizontalAlignment = !string.IsNullOrEmpty(sr.HorizontalAlignment) ?
(Aspose.Pdf.HorizontalAlignment)Enum.Parse(typeof(Aspose.Pdf.HorizontalAlignment), sr.HorizontalAlignment) :
checkBox.TextHorizontalAlignment; // Horiz Align
checkBox.ReadOnly = sr.ReadOnly; // Read Only
checkBox.Required = sr.Required; // Required
checkBox.Style = (Aspose.Pdf.Forms.BoxStyle)Enum.Parse(typeof(Aspose.Pdf.Forms.BoxStyle), sr.CheckboxStyle); // Button Style
checkBox.Checked = (bool)sr.CheckedByDefault; // Checked By Default
// checkBox.IsSynchronized = sr.CheckedInUnison; // IsSynchronized is read only
Doc.Form.Add(checkBox);
lastY = fldRect.LLY;
}