This example shows how to create a form with table.
private StiForm CreateForm()
{
	var form = new StiForm();

	var page = new StiFormPage();
	form.Pages.Add(page);

	var label = new StiLabelElement()
	{
		Geometry = new StiRectangleGeometry(0, 0, page.ContentAreaWidth, 200)
	};

	label.Text.Expression = "Custom Order Form";
	label.Text.Font = new System.Drawing.Font("Segoe UI", 44, System.Drawing.FontStyle.Bold);
	label.Text.HorizontalAlignment = StiHorizontalAlignment.Center;            

	page.Elements.Add(label); 

	var table = new StiTableElement()
	{
		Geometry = new StiRectangleGeometry(0, 200, page.ContentAreaWidth, 500),
		Padding = new StiPadding(0)
	};

	table.Columns.Add(new StiTextBoxColumnItem()
	{
		Label = "ITEM",
		HeaderAlignment = StiHorizontalAlignment.Center,
	});

	var sizeItem = new StiComboBoxColumnItem()
	{
		Label = "SIZE",
		HeaderAlignment = StiHorizontalAlignment.Center,
	};
	sizeItem.ComboBoxOptions.Add("S");
	sizeItem.ComboBoxOptions.Add("M");
	sizeItem.ComboBoxOptions.Add("L");
	table.Columns.Add(sizeItem);

	table.Columns.Add(new StiTextBoxColumnItem()
	{
		Label = "COLOR",
		HeaderAlignment = StiHorizontalAlignment.Center,
	});

	table.Columns.Add(new StiNumberBoxColumnItem()
	{
		Label = "QTY",
		HeaderAlignment = StiHorizontalAlignment.Center,
		DecimalDigits = 0,
		Width = 30,
	});

	table.Columns.Add(new StiNumberBoxColumnItem()
	{
		Label = "PRCE",
		HeaderAlignment = StiHorizontalAlignment.Center,
		Width = 60,
		UnitLabel = "$",
		UnitAlignment = StiUnitAlignment.PrefixInside
	});

	table.Columns.Add(new StiLabelColumnItem()
	{
		Label = "Total",
		HeaderAlignment = StiHorizontalAlignment.Center,
		Expression = "{Col(4) * Col(5)}",
		Prefix = "$",
		CellAlignment = StiHorizontalAlignment.Right
	});

	for (var i = 1; i <= 10; i++) 
	table.RowsCollection.Labels.Add(i.ToString());

	table.RowsCollection.Width = 20;
	table.RowsCollection.Alignment = StiHorizontalAlignment.Center;

	table.TotalsRow.Fields.Add(new StiTotalsFieldItem()
	{
		Header = "Total",
		Prefix = "$",
		Expression = "{Sum(Col(6))}"
	});

	page.Elements.Add(table);

	var button = new StiButtonElement()
	{
		ButtonType = StiButtonType.SendForm,
		Geometry = new StiRectangleGeometry(page.ContentAreaWidth / 2 - 200, 700, 400, 100)
	};
	button.Text.Value = "Submit";
	page.Elements.Add(button);

	return form;
}

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.