Class WebWorksheet

WebWorksheet class

Represents a web worksheet.

[Obsolete("This class is obsolete; use  GridWorksheet instead")]
public class WebWorksheet : Control, ISerializable

Constructors

NameDescription
WebWorksheet()The default constructor.
WebWorksheet(MainWeb, GridWorksheet)

Properties

NameDescription
BindColumns { get; }Bind columns collection.
BindingSource { get; }The actually binding datasource object at run-time. It is a DataView object when the DataSource property is a DataSet, DataTable or DataView object.
BindStartColumn { get; set; }In data-binding mode, BindStartRow and BindStartColumn indicate the position of the grid to bind bo the datasource.
BindStartRow { get; set; }In data-binding mode, BindStartRow and BindStartColumn indicate the position of the grid to bind bo the datasource.
CellImages { get; }
Cells { get; }Gets the WebCells.
Comments { get; }
CurrentBindRows { get; set; }Gets the binding rows number in data-binding mode.
DataMember { get; set; }Gets or sets the DataMember from the multi-member DataSource. Generally it represents a DataTable object of a DataSet.
DataSource { get; set; }Gets or sets the DataSource. Generally it’s a DataSet object.
EnableCreateBindColumnHeader { get; set; }In data-binding mode, indicates whether to create bind column header captions in the sheet.
Hyperlinks { get; }Gets the HyperlinkCollection collection.
Index { get; }Gets the index of itself within the worksheets.
IsProtected { get; set; }Gets or sets whether the worksheet is protected. When a worksheet is protected, all the cells can not be edit except the cell whose IsLocked property is false.
Name { get; set; }Gets or sets the name of the sheet.
RowFilter { get; }
Validations { get; }Gets the data validation setting collection in the worksheet.
override Visible { get; set; }Indicates whether this sheet’s name is shown in the sheet tabs of the control.

Methods

NameDescription
AutoFitColumn(int)Autofits the column width.
AutoFitColumn(int, int, int)Autofits the column width. This method autofits a column based on content in a range of cells within the column from startRow to endRow. AutoFitColumn is an imprecise function.
CancelNewBindRow()Cancels and deletes the new added bind row.
CommitNewBindRow()Commits the new added bind row and add it to the datasource.
Copy(WebWorksheet)Copies from another worksheet object.
CreateAutoGenratedColumns()After setting a datasource for the worksheet, call this method to generate the bind columns automatically.
CreateNewBindRow()Creates a new bind row and bind to the datasource.
CreateSubtotal(int, int, int, SubtotalFunction, int[], string, GridTableItemStyle, GridTableItemStyle, NumberType, string)Creates subtotal in the sheet.
override DataBind()Bind the sheet to the DataSource.
DeleteBindRow(int)Deletes a bind row.
FreezePanes(int, int, int, int)
GroupRows(int, int)Groups rows.
GroupRows(int, int, bool)Groups rows.
RemoveSubtotal()
SetAllCellsEditable()
SetAllCellsReadonly()
SetEditableRange(int, int, int, int)Makes a range of cells editable. http://docs.aspose.com:8082/docs/display/cellsnet/Protecting+Cells Make all cells read only by calling the SetAllCellsReadonly method. then call this method to Specify the range of cells that to be editable
SetReadonlyRange(int, int, int, int)Makes a range of cells readonly. http://docs.aspose.com:8082/docs/display/cellsnet/Protecting+Cells First make all cells editable by calling the SetAllCellsEditable method. then call this method to Specify the range of cells that to be readonly
UnfreezePanes()
UngroupRows(int, int)
UpdateBindCellValue(GridCell)Updates the binding datasource record’s property value according to the cell’s value.

Remarks

NOTE: This class is now obsolete. please use GridWorksheet Instead. This class will be removed after 6 months since Aug. 2014. Aspose apologizes for any inconvenience you may have experienced.

Examples


 [C#]
 ...
 using System.Web.UI.WebControls;
 ...
 ...

 WebWorksheets Worksheets = GridWeb1.WebWorksheets;
	WebCells cells = Worksheets[0].Cells;

	//Sets default row height
	cells.StandardHeight = new Unit(16, UnitType.Point);
	//Sets row height
	cells.SetRowHeight(2, new Unit(20, UnitType.Point));

	//Sets default colum width
	cells.StandardWidth = new Unit(50, UnitType.Point);
	//Sets column width
	cells.SetColumnWidth(3, new Unit(80, UnitType.Point));

	//Merge cells
	cells.Merge(5, 4, 2, 2);

	//Import data
	DataSet1 ds1 = new DataSet1();

	for (int i =0; i<16; i++)
	{
		DataSet1.Table1Row row = ds1.Table1.NewTable1Row();
		row["c1"] = "hello1";
		row["c2"] = i;
		row["c3"] = "data";
		ds1.Table1.AddTable1Row(row);
	}

	GridWeb1.WebWorksheets.ImportDataView(ds1.Table1.DefaultView, null, null);

 //Import from excel file
 Worksheets.ImportExcelFile("c:\\file1.xls");

 [Visual Basic]
	Imports System.Web.UI.WebControls
	...
	...

	Dim Worksheets As WebWorksheets =  GridWeb1.WebWorksheets
	Dim cells As WebCells =  Worksheets(0).Cells

	'Sets default row height
	cells.StandardHeight = New Unit(16, UnitType.Point)
	'Sets row height
	cells.SetRowHeight(2,New Unit(20,UnitType.Point))

	'Sets default colum width
	cells.StandardWidth = New Unit(50, UnitType.Point)
	'Sets column width
	cells.SetColumnWidth(3,New Unit(80,UnitType.Point))

	'Merge cells
	cells.Merge(5, 4, 2, 2)

	'Import data
	Dim ds1 As DataSet1 =  New DataSet1()

	Dim i As Integer
	For  i = 0 To 15
		Dim row As DataSet1.Table1Row =  ds1.Table1.NewTable1Row()
		row("c1") = "hello1"
		row("c2") = i
		row("c3") = "data"
		ds1.Table1.AddTable1Row(row)
	Next

	GridWeb1.WebWorksheets.ImportDataView(ds1.Table1.DefaultView, Nothing, Nothing)

	'Import from excel file
	Worksheets.ImportExcelFile("c:\\file1.xls")

See Also