[C#]
Validation v = cell1.CreateValidation(ValidationType.CustomExpression, true);
// Sets to number validation expression.
v.RegEx = "\\d+";
[Visual Basic]
Dim v As Validation = cell1.CreateValidation(ValidationType.CustomExpression,True)
' Sets to number validation expression.
v.RegEx = "\\d+"
[C#]
cell.Formula = "=SUM(A1:C3) + E6*2";
[Visual Basic]
cell.Formula = "=SUM(A1:C3) + E6*2"
[C#]
GridWeb1.WebWorksheets[0].Cells.Sort(1,0,25,6,3);
[VB]
GridWeb1.WebWorksheets(0).Cells.Sort(1,0,25,6,3)
[C#]
GridWeb1.WebWorksheets[0].Cells.Sort(0,1,4,14,3,SortOrder.Ascending,SortOrientation.SortLeftToRight,true)
[VB]
GridWeb1.WebWorksheets(0).Cells.Sort(0,1,4,14,3,SortOrder.Ascending,SortOrientation.SortLeftToRight,True)
[C#]
int[] indexes = new int[3];
indexes[0] = 0;
indexes[1] = 2;
indexes[2] = 3;
GridWeb1.WebWorksheets[0].Cells.Sort(1,0,25,6,indexes);
[VB]
Dim indexes() As Integer = New Integer(3) {}
indexes(0) = 0
indexes(1) = 2
indexes(2) = 3
GridWeb1.WebWorksheets(0).Cells.Sort(1,0,25,6,indexes)
[C#]
int[] indexes = new int[3];
indexes[0] = 0;
indexes[1] = 1;
indexes[2] = 3;
SortOrder[] orders = new SortOrder[3];
orders[0] = SortOrder.Ascending;
orders[1] = SortOrder.Descending;
orders[2] = SortOrder.Descending;
GridWeb1.WebWorksheets[0].Cells.Sort(0,1,4,14,indexes,orders,SortOrientation.SortLeftToRight,false);
[VB]
Dim indexes() As Integer = New Integer(3) {}
indexes(0) = 0
indexes(1) = 1
indexes(2) = 3
Dim orders() As SortOrder = New SortOrder(3) {}
orders(0) = SortOrder.Ascending
orders(1) = SortOrder.Descending
orders(2) = SortOrder.Descending
GridWeb1.WebWorksheets(0).Cells.Sort(0,1,4,14,indexes,orders,SortOrientation.SortLeftToRight,False)
[C#]
GridWeb1.WebWorksheets[0].Cells.SetBorders(0, 0, 5, 8, SetBorderPosition.Outline, borderStyle1);
[VB]
GridWeb1.WebWorksheets(0).Cells.SetBorders(0, 0, 5, 8, SetBorderPosition.Outline, borderStyle1)
[C#]
Cells cells = excel.Worksheets[0].Cells;
Cell cell = cells[0, 0]; //Gets the cell at "A1"
[Visual Basic]
Dim cells As Cells = excel.WorkSheets(0).Cells
Dim cell As Cell = cells(0,0) 'Gets the cell at "A1"
[C#]
Cells cells = excel.Worksheets[0].Cells;
Cell cell = cells["A1"]; //Gets the cell at "A1"
[Visual Basic]
Dim cells As Cells = excel.Worksheets(0).Cells
Dim cell As Cell = cells("A1") 'Gets the cell at "A1"
[C#]
Validation v = cell1.CreateValidation(GridValidationType.CustomExpression, true);
// Sets to number validation expression.
v.RegEx = "\\d+";
[Visual Basic]
Dim v As Validation = cell1.CreateValidation(GridValidationType.CustomExpression,True)
' Sets to number validation expression.
v.RegEx = "\\d+"
null,
Boolean,
DateTime,
Double,
Integer
String.
[C#]
cell.Formula = "=SUM(A1:C3) + E6*2";
[Visual Basic]
cell.Formula = "=SUM(A1:C3) + E6*2"
[C#]
GridWeb1.WebWorksheets[0].Cells.Sort(1,0,25,6,3,true,true,false);
[VB]
GridWeb1.WebWorksheets(0).Cells.Sort(1,0,25,6,3,true,true,false)
[C#]
GridWeb1.WebWorksheets[0].Cells.SetBorders(0, 0, 5, 8, SetBorderPosition.Outline, borderStyle1);
[VB]
GridWeb1.WebWorksheets(0).Cells.SetBorders(0, 0, 5, 8, SetBorderPosition.Outline, borderStyle1)
[C#]
Cells cells = excel.Worksheets[0].Cells;
//Gets the cell at "A1"
Cell cell = cells[0, 0];
[Visual Basic]
Dim cells As Cells = excel.WorkSheets(0).Cells
'Gets the cell at "A1"
Dim cell As Cell = cells(0,0)
[C#]
Cells cells = excel.Worksheets[0].Cells;
Cell cell = cells["A1"]; //Gets the cell at "A1"
[Visual Basic]
Dim cells As Cells = excel.Worksheets(0).Cells
Dim cell As Cell = cells("A1") 'Gets the cell at "A1"
[C#]
Worksheet worksheet = excel.Worksheets[0];
worksheet.Hyperlinks.Add("A4", 1, 1, "http://www.aspose.com");
worksheet.Hyperlinks.Add("A5", 1, 1, "c:\\book1.xls");
[Visual Basic]
Dim worksheet as Worksheet = excel.Worksheets(0)
worksheet.Hyperlinks.Add("A4", 1, 1, "http://www.aspose.com")
worksheet.Hyperlinks.Add("A5", 1, 1, "c:\\book1.xls")
Row index and column index cannot all be zero. Number of rows and number of columns also cannot all be zero.
The first two parameters specify the freezed position and the last two parameters specify the area freezed on the left top pane.
[C#]
GridWeb1.DefaultFontName = "Arial";
[Visual Basic]
GridWeb1.DefaultFontName = "Arial"
[C#]
GridWeb1.DefaultFontSize = new System.Web.UI.WebControls.FontUnit("10pt");
[Visual Basic]
GridWeb1.DefaultFontSize = New System.Web.UI.WebControls.FontUnit("10pt")
[C#]
onErrorActionQuery.OnErrorAction = OnErrorActionType.Ignore;
[VB]
onErrorActionQuery.OnErrorAction = OnErrorActionType.Ignore
[C#]
//On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
WebWorksheet sourceSheet = GridWeb1.WebWorksheets["Sheet1"];
Aspose.Cells.GridWeb.Data.WebCellArea sourceRange = new WebCellArea();
sourceRange.StartRow = 0;
sourceRange.StartColumn = 0;
sourceRange.EndRow = 10;
sourceRange.EndColumn = 5;
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet, sourceRange);
PivotTable table = cache.CreatePivotTable();
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[3].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[4].Orientation = PivotFieldOrientation.ColumnField;
table.PivotFields[5].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[3].Function = PivotFieldFunction.Count;
table.PivotFields[5].Function = PivotFieldFunction.Sum;
table.DataBind();
//Creates a PivotTable report from DataView or DataTable.
DataView dataView;//Or DataTable dataTable;
.
.
.
Sets dataView(dataTable) Value
.
.
.
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView);
//Or PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable);
PivotTable table = cache.CreatePivotTable();
table = GridWeb1.WebWorksheets.PivotTables["PivotTable1"];
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.DataBind();
[VB]
'On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
Dim sourceSheet As WebWorksheet = GridWeb1.WebWorksheets("Sheet1")
Dim sourceRange As Aspose.Cells.GridWeb.Data.WebCellArea = New WebCellArea()/
sourceRange.StartRow = 0
sourceRange.StartColumn = 0
sourceRange.EndRow = 10
sourceRange.EndColumn = 5
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet,sourceRange)
Dim table As PivotTable = cache.CreatePivotTable()
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.RowField
table.PivotFields(3).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(4).Orientation = PivotFieldOrientation.ColumnField
table.PivotFields(5).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(3).Function = PivotFieldFunction.Count
table.PivotFields(5).Function = PivotFieldFunction.Sum
table.DataBind()
'Creates a PivotTable report from DataView or DataTable.
Dim dataView As DataView ' Or Dim dataTable As DataTable
.
.
Sets dataView(dataTable) Value
.
.
.
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView)
'Or Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable)
Dim table As PivotTable = cache.CreatePivotTable()
table = GridWeb1.WebWorksheets.PivotTables("PivotTable1")
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.DataBind()
[C#]
//Changes data source range
//Original value: StartRow=0;StartColumn=0;EndRow=10;EndColumn=4;
PivotTable table = GridWeb1.WebWorksheets.PivotTables["myPivotTable"];
//Adds 2 row data
table.PivotCache.SourceCellArea.EndRow = 12;
[VB]
'Changes data source range
'Original value: StartRow=0;StartColumn=0;EndRow=10;EndColumn=4;
Dim table As PivotTable = GridWeb1.WebWorksheets.PivotTables("myPivotTable")
'Adds 2 row data
table.PivotCache.SourceCellArea.EndRow = 12
[C#]
//On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
WebWorksheet sourceSheet = GridWeb1.WebWorksheets["Sheet1"];
Aspose.Cells.GridWeb.Data.WebCellArea sourceRange = new WebCellArea();
sourceRange.StartRow = 0;
sourceRange.StartColumn = 0;
sourceRange.EndRow = 10;
sourceRange.EndColumn = 5;
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet, sourceRange);
PivotTable table = cache.CreatePivotTable();
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[3].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[4].Orientation = PivotFieldOrientation.ColumnField;
table.PivotFields[5].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[3].Function = PivotFieldFunction.Count;
table.PivotFields[5].Function = PivotFieldFunction.Sum;
table.DataBind();
//Creates a PivotTable report from DataView or DataTable.
DataView dataView;//Or DataTable dataTable;
.
.
.
Sets dataView(dataTable) Value
.
.
.
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView);
//Or PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable);
PivotTable table = cache.CreatePivotTable();
table = GridWeb1.WebWorksheets.PivotTables["PivotTable1"];
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.DataBind();
[VB]
'On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
Dim sourceSheet As WebWorksheet = GridWeb1.WebWorksheets("Sheet1")
Dim sourceRange As Aspose.Cells.GridWeb.Data.WebCellArea = New WebCellArea()/
sourceRange.StartRow = 0
sourceRange.StartColumn = 0
sourceRange.EndRow = 10
sourceRange.EndColumn = 5
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet,sourceRange)
Dim table As PivotTable = cache.CreatePivotTable()
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.RowField
table.PivotFields(3).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(4).Orientation = PivotFieldOrientation.ColumnField
table.PivotFields(5).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(3).Function = PivotFieldFunction.Count
table.PivotFields(5).Function = PivotFieldFunction.Sum
table.DataBind()
'Creates a PivotTable report from DataView or DataTable.
Dim dataView As DataView ' Or Dim dataTable As DataTable
.
.
Sets dataView(dataTable) Value
.
.
.
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView)
'Or Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable)
Dim table As PivotTable = cache.CreatePivotTable()
table = GridWeb1.WebWorksheets.PivotTables("PivotTable1")
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.DataBind()
[C#]
//Gets PivotFields of PivotTable[0]
PivotField field1 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field1"];
PivotField field2 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field2"];
PivotField field3 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field3"];
PivotField field4 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field4"];
//Sets Location of PivotFields
field1.Orientation = PivotFieldOrientation.RowField;
field2.Orientation = PivotFieldOrientation.RowField;
field3.Orientation = PivotFieldOrientation.ColumnField;
field4.Orientation = PivotFieldOrientation.DataField;
//Sets function of data field
field3.Function = PivotFieldFunction.Sum;
//Changes row fields order
field2.Position = 1; //Or field1.Position = 2;
[VB]
'Gets PivotFields of PivotTable[0]
Dim field1 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field1")
Dim field2 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field2")
Dim field3 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field3")
Dim field4 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field4")
'Sets Location of PivotFields
field1.Orientation = PivotFieldOrientation.RowField
field2.Orientation = PivotFieldOrientation.RowField
field3.Orientation = PivotFieldOrientation.ColumnField
field4.Orientation = PivotFieldOrientation.DataField
'Sets function of data field
field3.Function = PivotFieldFunction.Sum
'Changes row fields order
field2.Position = 1 'Or field1.Position = 2;
[C#]
//Gets PivotFields of PivotTable[0]
PivotField field1 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field1"];
PivotField field2 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field2"];
PivotField field3 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field3"];
PivotField field4 = GridWeb1.WebWorksheets.PivotTables[0].PivotFields["field4"];
//Sets Location of PivotFields
field1.Orientation = PivotFieldOrientation.RowField;
field2.Orientation = PivotFieldOrientation.RowField;
field3.Orientation = PivotFieldOrientation.ColumnField;
field4.Orientation = PivotFieldOrientation.DataField;
//Sets function of data field
field3.Function = PivotFieldFunction.Sum;
//Changes row fields order
field2.Position = 1; //Or field1.Position = 2;
[VB]
'Gets PivotFields of PivotTable[0]
Dim field1 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field1")
Dim field2 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field2")
Dim field3 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field3")
Dim field4 As PivotField = GridWeb1.WebWorksheets.PivotTables(0).PivotFields("field4")
'Sets Location of PivotFields
field1.Orientation = PivotFieldOrientation.RowField
field2.Orientation = PivotFieldOrientation.RowField
field3.Orientation = PivotFieldOrientation.ColumnField
field4.Orientation = PivotFieldOrientation.DataField
'Sets function of data field
field3.Function = PivotFieldFunction.Sum
'Changes row fields order
field2.Position = 1 'Or field1.Position = 2;
[C#]
//On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
WebWorksheet sourceSheet = GridWeb1.WebWorksheets["Sheet1"];
Aspose.Cells.GridWeb.Data.WebCellArea sourceRange = new WebCellArea();
sourceRange.StartRow = 0;
sourceRange.StartColumn = 0;
sourceRange.EndRow = 10;
sourceRange.EndColumn = 5;
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet, sourceRange);
PivotTable table = cache.CreatePivotTable();
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[3].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[4].Orientation = PivotFieldOrientation.ColumnField;
table.PivotFields[5].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[3].Function = PivotFieldFunction.Count;
table.PivotFields[5].Function = PivotFieldFunction.Sum;
table.DataBind();
//Creates a PivotTable report from DataView or DataTable.
DataView dataView;//Or DataTable dataTable;
.
.
.
Sets dataView(dataTable) Value
.
.
.
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView);
//Or PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable);
PivotTable table = cache.CreatePivotTable();
table = GridWeb1.WebWorksheets.PivotTables["PivotTable1"];
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.DataBind();
[VB]
'On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
Dim sourceSheet As WebWorksheet = GridWeb1.WebWorksheets("Sheet1")
Dim sourceRange As Aspose.Cells.GridWeb.Data.WebCellArea = New WebCellArea()/
sourceRange.StartRow = 0
sourceRange.StartColumn = 0
sourceRange.EndRow = 10
sourceRange.EndColumn = 5
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet,sourceRange)
Dim table As PivotTable = cache.CreatePivotTable()
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.RowField
table.PivotFields(3).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(4).Orientation = PivotFieldOrientation.ColumnField
table.PivotFields(5).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(3).Function = PivotFieldFunction.Count
table.PivotFields(5).Function = PivotFieldFunction.Sum
table.DataBind()
'Creates a PivotTable report from DataView or DataTable.
Dim dataView As DataView ' Or Dim dataTable As DataTable
.
.
Sets dataView(dataTable) Value
.
.
.
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView)
'Or Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable)
Dim table As PivotTable = cache.CreatePivotTable()
table = GridWeb1.WebWorksheets.PivotTables("PivotTable1")
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.DataBind()
[C#]
//On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
WebWorksheet sourceSheet = GridWeb1.WebWorksheets["Sheet1"];
Aspose.Cells.GridWeb.Data.WebCellArea sourceRange = new WebCellArea();
sourceRange.StartRow = 0;
sourceRange.StartColumn = 0;
sourceRange.EndRow = 10;
sourceRange.EndColumn = 5;
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet, sourceRange);
PivotTable table = cache.CreatePivotTable();
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[3].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[4].Orientation = PivotFieldOrientation.ColumnField;
table.PivotFields[5].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.PivotFields[3].Function = PivotFieldFunction.Count;
table.PivotFields[5].Function = PivotFieldFunction.Sum;
table.DataBind();
//Creates a PivotTable report from DataView or DataTable.
DataView dataView;//Or DataTable dataTable;
.
.
.
Sets dataView(dataTable) Value
.
.
.
PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView);
//Or PivotCache cache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable);
PivotTable table = cache.CreatePivotTable();
table = GridWeb1.WebWorksheets.PivotTables["PivotTable1"];
table.PivotFields[0].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[1].Orientation = PivotFieldOrientation.RowField;
table.PivotFields[2].Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField;
table.DataBind();
[VB]
'On the assumption that worksheet "Sheet1" has datas, then creates a PivotTable report base on it.
Dim sourceSheet As WebWorksheet = GridWeb1.WebWorksheets("Sheet1")
Dim sourceRange As Aspose.Cells.GridWeb.Data.WebCellArea = New WebCellArea()/
sourceRange.StartRow = 0
sourceRange.StartColumn = 0
sourceRange.EndRow = 10
sourceRange.EndColumn = 5
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(sourceSheet,sourceRange)
Dim table As PivotTable = cache.CreatePivotTable()
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.RowField
table.PivotFields(3).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(4).Orientation = PivotFieldOrientation.ColumnField
table.PivotFields(5).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.PivotFields(3).Function = PivotFieldFunction.Count
table.PivotFields(5).Function = PivotFieldFunction.Sum
table.DataBind()
'Creates a PivotTable report from DataView or DataTable.
Dim dataView As DataView ' Or Dim dataTable As DataTable
.
.
Sets dataView(dataTable) Value
.
.
.
Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataView)
'Or Dim cache As PivotCache = GridWeb1.WebWorksheets.PivotCaches.Add(dataTable)
Dim table As PivotTable = cache.CreatePivotTable()
table = GridWeb1.WebWorksheets.PivotTables("PivotTable1")
table.PivotFields(0).Orientation = PivotFieldOrientation.RowField
table.PivotFields(1).Orientation = PivotFieldOrientation.RowField
table.PivotFields(2).Orientation = PivotFieldOrientation.ColumnField | PivotFieldOrientation.DataField
table.DataBind()
[C#]
GridWeb1.WebWorksheets[0].Cells.SetBorders(0, 0, 5, 8, SetBorderPosition.Outline, borderStyle1);
[VB]
GridWeb1.WebWorksheets(0).Cells.SetBorders(0, 0, 5, 8, SetBorderPosition.Outline, borderStyle1)
[C#]
...
using System.Web.UI.WebControls;
...
...
WebWorksheets sheets = GridWeb1.WebWorksheets;
sheets.Clear();
WebWorksheet sheet = sheets[sheets.Add("demo1")];
WebCell cell = sheet.Cells[0,0];
cell.StringValue = "Demo Text";
Aspose.Cells.GridWeb.TableItemStyle style = cell.GetStyle();
style.Font.Size = new FontUnit("72pt");
style.Wrap = false;
style.BackColor = Color.Gray;
style.BorderStyle = BorderStyle.Solid;
style.BorderWidth = new Unit(1, UnitType.Pixel);
style.BorderColor = Color.Silver;
style.RightBorderStyle.BorderColor = Color.Black;
style.RightBorderStyle.BorderStyle = BorderStyle.Solid;
style.RightBorderStyle.BorderWidth = new Unit(1, UnitType.Pixel);
style.BottomBorderStyle.BorderColor = Color.Black;
style.BottomBorderStyle.BorderStyle = BorderStyle.Solid;
style.BottomBorderStyle.BorderWidth = new Unit(1, UnitType.Pixel);
cell.SetStyle(style);
[Visual Basic]
...
Imports System.Web.UI.WebControls
...
...
Dim sheets As WebWorksheets = GridWeb1.WebWorksheets
sheets.Clear()
Dim sheet As WebWorksheet = sheets(sheets.Add(__0__))
Dim cell As WebCell = sheet.Cells(0,0)
cell.StringValue = "Demo Text"
Dim style As Aspose.Cells.GridWeb.TableItemStyle = cell.GetStyle()
style.Font.Size = New FontUnit("72pt")
style.Wrap = False
style.BackColor = Color.Gray
style.BorderStyle = BorderStyle.Solid
style.BorderWidth = New Unit(1, UnitType.Pixel)
style.BorderColor = Color.Silver
style.RightBorderStyle.BorderColor = Color.Black
style.RightBorderStyle.BorderStyle = BorderStyle.Solid
style.RightBorderStyle.BorderWidth = New Unit(1, UnitType.Pixel)
style.BottomBorderStyle.BorderColor = Color.Black
style.BottomBorderStyle.BorderStyle = BorderStyle.Solid
style.BottomBorderStyle.BorderWidth = New Unit(1, UnitType.Pixel)
cell.SetStyle(style)
0: Not rotated.
255: Top to Bottom.
-90: Downward.
90: Upward.
You can set 255 or value ranged from -90 to 90.Value | Type | Format String |
0 | General | General |
1 | Decimal | 0 |
2 | Decimal | 0.00 |
3 | Decimal | #,##0 |
4 | Decimal | #,##0.00 |
5 | Currency | $#,##0;($#,##0) |
6 | Currency | $#,##0;[Red]($#,##0) |
7 | Currency | $#,##0.00;($#,##0.00) |
8 | Currency | $#,##0.00;[Red]($#,##0.00) |
9 | Percentage | 0% |
10 | Percentage | 0.00% |
11 | Scientific | 0.00E+00 |
12 | Fraction | # ?/? |
13 | Fraction | # ??/?? |
14 | Date | m/d/yyyy |
15 | Date | d-mmm-yy |
16 | Date | d-mmm |
17 | Date | mmm-yy |
18 | Time | h:mm AM/PM |
19 | Time | h:mm:ss AM/PM |
20 | Time | h:mm |
21 | Time | h:mm:ss |
22 | Time | m/d/yyyy h:mm |
37 | Accounting | #,##0;(#,##0) |
38 | Accounting | #,##0;[Red](#,##0) |
39 | Accounting | #,##0.00;(#,##0.00) |
40 | Accounting | #,##0.00;[Red](#,##0.00) |
41 | Accounting | _ * #,##0_ ;_ * (#,##0)_ ;_ * "-"_ ;_ @_ |
42 | Currency | _ $* #,##0_ ;_ $* (#,##0)_ ;_ $* "-"_ ;_ @_ |
43 | Accounting | _ * #,##0.00_ ;_ * (#,##0.00)_ ;_ * "-"??_ ;_ @_ |
44 | Currency | _ $* #,##0.00_ ;_ $* (#,##0.00)_ ;_ $* "-"??_ ;_ @_ |
45 | Time | mm:ss |
46 | Time | [h]:mm:ss |
47 | Time | mm:ss.0 |
48 | Scientific | ##0.0E+00 |
49 | Text | @ |
Use this method to load a license from a stream.
[C#]
License license = new License();
license.SetLicense(myStream);
[Visual Basic]
Dim license as License = new License
license.SetLicense(myStream)
Tries to find the license in the following locations:
1. Explicit path.
2. The folder that contains the Aspose component assembly.
3. The folder that contains the client's calling assembly.
4. The folder that contains the entry (startup) assembly.
5. An embedded resource in the client's calling assembly.
Note:On the .NET Compact Framework, tries to find the license only in these locations:
1. Explicit path.
2. An embedded resource in the client's calling assembly.
[C#]
License license = new License();
license.SetLicense("MyLicense.lic");
[Visual Basic]
Dim license As License = New License
license.SetLicense("MyLicense.lic")
Can be a full or short file name or name of an embedded resource.
Use an empty string to switch to evaluation mode.
[C#]
CustomCommandButton button = new CustomCommandButton();
button.Command = "MyCommand";
button.ImageUrl = "images/button1.gif";
GridWeb1.CustomCommandButtons.Add(button);
[VB]
Dim button As CustomCommandButton = New CustomCommandButton()
button.Command = "MyCommand"
button.ImageUrl = "images/button1.gif"
GridWeb1.CustomCommandButtons.Add(button)
[C#]
CustomCommandButton button = new CustomCommandButton();
button.Command = "MyCommand";
button.ImageUrl = "images/button1.gif";
GridWeb1.CustomCommandButtons.Add(button);
[VB]
Dim button As CustomCommandButton = New CustomCommandButton()
button.Command = "MyCommand"
button.ImageUrl = "images/button1.gif"
GridWeb1.CustomCommandButtons.Add(button)
[C#]
GridWeb1.DefaultGridLineColor = Color.Red;
[Visual Basic]
GridWeb1.DefaultGridLineColor = Color.Red
[C#]
GridWeb1.DefaultFontName = "Arial";
[Visual Basic]
GridWeb1.DefaultFontName = "Arial"
[C#]
GridWeb1.DefaultFontSize = new System.Web.UI.WebControls.FontUnit("10pt");
[Visual Basic]
GridWeb1.DefaultFontSize = New System.Web.UI.WebControls.FontUnit("10pt")
[C#]
// Creates a 4x4 "display window".
GridWeb1.MinRow = 2;
GridWeb1.MaxRow = 5;
GridWeb1.MinColumn = 3;
GridWeb1.MaxColumn = 6;
[Visual Basic]
' Creates a 4x4 "display window".
GridWeb1.MinRow = 2
GridWeb1.MaxRow = 5
GridWeb1.MinColumn = 3
GridWeb1.MaxColumn = 6
[C#]
// Creates a 4x4 "display window".
GridWeb1.MinRow = 2;
GridWeb1.MaxRow = 5;
GridWeb1.MinColumn = 3;
GridWeb1.MaxColumn = 6;
[Visual Basic]
' Creates a 4x4 "display window".
GridWeb1.MinRow = 2
GridWeb1.MaxRow = 5
GridWeb1.MinColumn = 3
GridWeb1.MaxColumn = 6
[C#]
// Creates a 4x4 "display window".
GridWeb1.MinRow = 2;
GridWeb1.MaxRow = 5;
GridWeb1.MinColumn = 3;
GridWeb1.MaxColumn = 6;
[Visual Basic]
' Creates a 4x4 "display window".
GridWeb1.MinRow = 2
GridWeb1.MaxRow = 5
GridWeb1.MinColumn = 3
GridWeb1.MaxColumn = 6
[C#]
GridWeb1.PresetStyle = PresetStyle.Traditional1;
[Visual Basic]
GridWeb1.PresetStyle = PresetStyle.Traditional1
[C#]
GridWeb1.SessionMode = SessionMode.ViewState;
[Visual Basic]
GridWeb1.SessionMode = SessionMode.ViewState
[C#]
GridWeb1.CustomStyleFileName = "c:\\style\\mystyle.xml";
[Visual Basic]
GridWeb1.CustomStyleFileName = "c:\\style\\mystyle.xml"
[C#]
GridWeb1.Width = new System.Web.UI.WebControls.Unit(320, System.Web.UI.WebControls.UnitType.Point);
GridWeb1.Height = new System.Web.UI.WebControls.Unit(240, System.Web.UI.WebControls.UnitType.Point);
[Visual Basic]
GridWeb1.Width = New System.Web.UI.WebControls.Unit(320, System.Web.UI.WebControls.UnitType.Point)
GridWeb1.Height = New System.Web.UI.WebControls.Unit(240, System.Web.UI.WebControls.UnitType.Point)
[C#]
GridWeb1.Width = new System.Web.UI.WebControls.Unit(320, System.Web.UI.WebControls.UnitType.Point);
GridWeb1.Height = new System.Web.UI.WebControls.Unit(240, System.Web.UI.WebControls.UnitType.Point);
[Visual Basic]
GridWeb1.Width = New System.Web.UI.WebControls.Unit(320, System.Web.UI.WebControls.UnitType.Point)
GridWeb1.Height = New System.Web.UI.WebControls.Unit(240, System.Web.UI.WebControls.UnitType.Point)
[C#]
GridWeb1.HeaderBarWidth = new System.Web.UI.WebControls.Unit(32, System.Web.UI.WebControls.UnitType.Point);
GridWeb1.HeaderBarHeight = new System.Web.UI.WebControls.Unit(24, System.Web.UI.WebControls.UnitType.Point);
[Visual Basic]
GridWeb1.HeaderBarWidth = New System.Web.UI.WebControls.Unit(32, System.Web.UI.WebControls.UnitType.Point)
GridWeb1.HeaderBarHeight = New System.Web.UI.WebControls.Unit(24, System.Web.UI.WebControls.UnitType.Point)
[C#]
GridWeb1.HeaderBarWidth = new System.Web.UI.WebControls.Unit(32, System.Web.UI.WebControls.UnitType.Point);
GridWeb1.HeaderBarHeight = new System.Web.UI.WebControls.Unit(24, System.Web.UI.WebControls.UnitType.Point);
[Visual Basic]
GridWeb1.HeaderBarWidth = New System.Web.UI.WebControls.Unit(32, System.Web.UI.WebControls.UnitType.Point)
GridWeb1.HeaderBarHeight = New System.Web.UI.WebControls.Unit(24, System.Web.UI.WebControls.UnitType.Point)
[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")
cell.PutValue(23.11);
sheet.UpdateBindCellValue(cell);
[C#]
WebCell cell1 = GridWeb1.WebWorksheets[0].Cells["A1"];
cell1.Style.LeftBorderStyle.BorderColor = System.Drawing.Color.Red;
cell1.Style.LeftBorderStyle.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
cell1.Style.LeftBorderStyle.BorderWidth = new System.Web.UI.WebControls.Unit(16, System.Web.UI.WebControls.UnitType.Point);
[Visual Basic]
Dim cell1 As WebCell = GridWeb1.WebWorksheets(0).Cells("A1")
cell1.Style.LeftBorderStyle.BorderColor = System.Drawing.Color.Red
cell1.Style.LeftBorderStyle.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid
cell1.Style.LeftBorderStyle.BorderWidth = New System.Web.UI.WebControls.Unit(16, System.Web.UI.WebControls.UnitType.Point)
[C#]
public class MyEngine : GridAbstractCalculationEngine
{
public override void Calculate(GridCalculationData data)
{
string funcName = data.FunctionName.ToUpper();
if ("MYFUNC".Equals(funcName))
{
//do calculation for MYFUNC here
int count = data.ParamCount;
object res = null;
for (int i = 0; i < count; i++)
{
object pv = data.GetParamValue(i);
if (pv is ReferredArea)
{
ReferredArea ra = (ReferredArea)pv;
pv = ra.GetValue(0, 0);
}
//process the parameter here
//res = ...;
}
data.CalculatedValue = res;
}
}
}