protected void btnSetRowHeight_Click(object sender, EventArgs e) { if (Page.IsValid) { // ExStart:SetRowHeight // Get row index entered by user int rowIndex = Convert.ToInt16(txtRowIndex.Text.Trim()); // Get row height entered by user int rowHeight = Convert.ToInt16(txtRowHeight.Text.Trim()); // Accessing the cells collection of the worksheet that is currently active WebCells cells = GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex].Cells; // Resize row at specified index to specified height cells.SetRowHeight(rowIndex, new Unit(rowHeight, UnitType.Point)); // ExEnd:SetRowHeight } }
protected void btnSetColumnWidth_Click(object sender, EventArgs e) { if (Page.IsValid) { // ExStart:SetColumnWidth // Get column index entered by user int columnIndex = Convert.ToInt16(txtColumnIndex.Text.Trim()); // Get column width entered by user int columnWidth = Convert.ToInt16(txtColumnWidth.Text.Trim()); // Accessing the cells collection of the worksheet that is currently active WebCells cells = GridWeb1.WebWorksheets[GridWeb1.ActiveSheetIndex].Cells; // Resize column at specified index to specified width cells.SetColumnWidth(columnIndex, new Unit(columnWidth, UnitType.Point)); // ExEnd:SetColumnWidth } }