[C#]
gridDesktop1.Worksheets[0].Cells[0, 0].Value = "2";
gridDesktop1.Worksheets[0].Cells[1, 0].Value = "3";
gridDesktop1.Worksheets[0].Cells[2, 1].Value = "=a1*a2";
gridDesktop1.RunAllFormulas();
gridDesktop1.Invalidate();
[Visual Basic]
gridDesktop1.Worksheets(0).Cells(0, 0).Value = "2"
gridDesktop1.Worksheets(0).Cells(1, 0).Value = "3"
gridDesktop1.Worksheets(0).Cells(2, 1).Value = "=a1*a2"
gridDesktop1.RunAllFormulas()
gridDesktop1.Invalidate()
[C#]
gridDesktop1.Clear();
gridDesktop1.Worksheets.Add();
gridDesktop1.Worksheets.Insert(0);
[Visual Basic]
gridDesktop1.Clear()
gridDesktop1.Worksheets.Add()
gridDesktop1.Worksheets.Insert(0)
[C#]
Worksheet worksheet = gridDesktop1.GetActiveWorksheet();
[Visual Basic]
Dim worksheet As Worksheet = gridDesktop1.GetActiveWorksheet()
[C#]
gridDesktop1.ShowStyleDialog();
[Visual Basic]
gridDesktop1.ShowStyleDialog()
[C#]
private void button1_Click(object sender, System.EventArgs e)
{
FileStream fs = new FileStream("d:\\bookx.xls", FileMode.Open);
try
{
gridDesktop1.ImportExcelFile(fs);
}
catch(Exception ex)
{
}
finally
{
fs.Close();
}
}
[Visual Basic]
Private Sub menuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuItem6.Click
Dim fs As FileStream = New FileStream("d:\bookx.xls",FileMode.Open)
Try
gridDesktop1.ImportExcelFile(fs)
Catch ex As Exception
Throw ex
Finally
fs.Close()
End Try
End Sub
[C#]
private void button1_Click(object sender, System.EventArgs e)
{
gridDesktop1.ImportExcelFile("FinancialPlan.xls");
}
[Visual Basic]
Private Sub menuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuItem6.Click
gridDesktop1.ImportExcelFile("FinancialPlan.xls")
End Sub
[C#]
private void button1_Click(object sender, System.EventArgs e)
{
FileStream fs = new FileStream("d:\\bookx.xls", FileMode.OpenOrCreate);
try
{
gridDesktop1.Worksheets.ExportExcelFile(fs);
}
catch(Exception ex)
{
}
finally
{
fs.Close();
}
}
[Visual Basic]
Private Sub menuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuItem6.Click
Dim fs As FileStream = New FileStream("d:\bookx.xls", FileMode.OpenOrCreate)
Try
gridDesktop1.Worksheets.ExportExcelFile(fs)
Catch ex As Exception
Throw ex
Finally
fs.Close()
End Try
End Sub
[C#]
private void button1_Click(object sender, System.EventArgs e)
{
gridDesktop1.Worksheets.ExportExcelFile("savedemo.xls");
}
[Visual Basic]
Private Sub menuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuItem7.Click
gridDesktop1.Worksheets.ExportExcelFile("savedemo.xls")
End Sub
[C#]
gridDesktop1.StartFormatPainter(true);
[Visual Basic]
gridDesktop1.StartFormatPainter(True)
[C#]
gridDesktop1.StartFormatPainter(false);
...
//User Interface Operation
...
gridDesktop1.EndFormatPainter();
[Visual Basic]
gridDesktop1.StartFormatPainter(False)
...
'User Interface Operation
...
gridDesktop1.EndFormatPainter()
[C#]
gridDesktop1.Worksheets[0].Cells[0, 0].Value = "2";
gridDesktop1.Worksheets[0].Cells[1, 0].Value = "3";
gridDesktop1.Worksheets[0].Cells[2, 1].Value = "=a1*a2";
gridDesktop1.RunAllFormulas();
gridDesktop1.Invalidate();
[Visual Basic]
gridDesktop1.Worksheets(0).Cells(0, 0).Value = "2"
gridDesktop1.Worksheets(0).Cells(1, 0).Value = "3"
gridDesktop1.Worksheets(0).Cells(2, 1).Value = "=a1*a2"
gridDesktop1.RunAllFormulas()
gridDesktop1.Invalidate()
[C#]
gridDesktop1.ActiveSheetIndex = 0;
[Visual Basic]
gridDesktop1.ActiveSheetIndex = 0
[C#]
private void gridDesktop1_SelectedSheetIndexChanged(object sender, System.EventArgs e)
{
MessageBox.Show("selected index changed!");
}
[Visual Basic]
Private Sub gridDesktop1_SelectedSheetIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gridDesktop1.SelectedSheetIndexChanged
MessageBox.Show("selected index changed!")
End Sub
[C#]
private void gridDesktop1_CellDataChanged(object sender, Aspose.Cells.GridDesktop.Event.CellEventArgs e)
{
MessageBox.Show("Cell Data changed!");
}
[Visual Basic]
Private Sub gridDesktop1_CellDataChanged(ByVal sender As Object, ByVal e As Aspose.Cells.GridDesktop.Event.CellEventArgs) Handles gridDesktop1.CellDataChanged
MessageBox.Show("Cell Data changed!")
End Sub
[C#]
private void gridDesktop1_BeforeLoadFile(object sender, Aspose.Cells.GridDesktop.Event.WorkBookEvents e)
{
MessageBox.Show("before load file!");
}
[Visual Basic]
Private Sub gridDesktop1_BeforeLoadFile(ByVal sender As Object, ByVal e As Aspose.Cells.GridDesktop.Event.WorkBookEvents) Handles gridDesktop1.CellDataChanged
MessageBox.Show("before load file!")
End Sub
[C#]
private void gridDesktop1_FinishLoadFile(object sender, Aspose.Cells.GridDesktop.WorkBookEvents e)
{
MessageBox.Show("finish load file!");
}
[Visual Basic]
Private Sub gridDesktop1_FinishLoadFile(ByVal sender As Object, ByVal e As Aspose.Cells.GridDesktop.WorkBookEvents) Handles gridDesktop1.CellDataChanged
MessageBox.Show("finish load file!")
End Sub
[C#]
private void gridDesktop1_BeforeCalculate(object sender, Aspose.Cells.GridDesktop.Event.WorkBookEvents e)
{
MessageBox.Show("before calculate formula!");
}
[Visual Basic]
Private Sub gridDesktop1_BeforeCalculate(ByVal sender As Object, ByVal e As Aspose.Cells.GridDesktop.Event.WorkBookEvents) Handles gridDesktop1.CellDataChanged
MessageBox.Show("before calculate formula!")
End Sub
[C#]
private void gridDesktop1_FinishCalculate(object sender, Aspose.Cells.GridDesktop.Event.WorkBookEvents e)
{
MessageBox.Show("finish calculate formula!");
}
[Visual Basic]
Private Sub gridDesktop1_FinishCalculate(ByVal sender As Object, ByVal e As Aspose.Cells.GridDesktop.Event.WorkBookEvents) Handles gridDesktop1.CellDataChanged
MessageBox.Show("finish calculate formula!")
End Sub
[C#]
gridDesktop1.Worksheets.Add();
gridDesktop1.Worksheets.Insert(0);
[Visual Basic]
gridDesktop1.Worksheets.Add()
gridDesktop1.Worksheets.Insert(0)
[C#]
Style style = sheet.GetCell(0, 0).GetStyle();
style.CellLocked = true;
style.VAlignment = VerticalAlignmentType.Top;
...
sheet.GetCell(0, 0).SetStyle(style);
[Visual Basic]
Dim style As Style = sheet.GetCell(0,0).GetStyle()
style.CellLocked = True
style.VAlignment = VerticalAlignmentType.Top
...
sheet.GetCell(0, 0).SetStyle(style)
[C#]
Style style = sheet.GetCell(0, 0).GetStyle();
style.CellLocked = true;
style.VAlignment = VerticalAlignmentType.Top;
...
sheet.GetCell(0, 0).SetStyle(style);
[Visual Basic]
Dim style As Style = sheet.GetCell(0,0).GetStyle()
style.CellLocked = True
style.VAlignment = VerticalAlignmentType.Top
...
sheet.GetCell(0, 0).SetStyle(style)
[C#]
GridCell cell = gridDesktop1.GetActiveWorksheet().Cells[0, 0];
Font font = new Font("Courier New", 8, FontStyle.Italic);
cell.SetFont(font);
Color color = cell.GetFontColor();
color = Color.Black;
cell.SetFontColor(color);
[Visual Basic]
Dim cell As GridCell = gridDesktop1.GetActiveWorksheet().Cells(0, 0)
Dim font As Font = New Font("Courier New",8,FontStyle.Italic)
cell.SetFont(font)
Dim color As Color = cell.GetFontColor()
color = Color.Black
cell.SetFontColor(color)
[C#]
GridCell cell = gridDesktop1.GetActiveWorksheet().Cells[0, 0];
Font font = new Font("Courier New", 8, FontStyle.Italic);
cell.SetFont(font);
Color color = cell.GetFontColor();
color = Color.Black;
cell.SetFontColor(color);
[Visual Basic]
Dim cell As GridCell = gridDesktop1.GetActiveWorksheet().Cells(0, 0)
Dim font As Font = New Font("Courier New",8,FontStyle.Italic)
cell.SetFont(font)
Dim color As Color = cell.GetFontColor()
color = Color.Black
cell.SetFontColor(color)
[C#]
GridCell cell = gridDesktop1.GetActiveWorksheet().Cells[0, 0];
Font font = new Font("Courier New", 8, FontStyle.Italic);
cell.SetFont(font);
Color color = cell.GetFontColor();
color = Color.Black;
cell.SetFontColor(color);
[Visual Basic]
Dim cell As GridCell = gridDesktop1.GetActiveWorksheet().Cells(0, 0)
Dim font As Font = New Font("Courier New",8,FontStyle.Italic)
cell.SetFont(font)
Dim color As Color = cell.GetFontColor()
color = Color.Black
cell.SetFontColor(color)
[C#]
GridCell cell = gridDesktop1.GetActiveWorksheet().Cells[0, 0];
Font font = new Font("Courier New", 8, FontStyle.Italic);
cell.SetFont(font);
Color color = cell.GetFontColor();
color = Color.Black;
cell.SetFontColor(color);
[Visual Basic]
Dim cell As GridCell = gridDesktop1.GetActiveWorksheet().Cells(0, 0)
Dim font As Font = New Font("Courier New",8,FontStyle.Italic)
cell.SetFont(font)
Dim color As Color = cell.GetFontColor()
color = Color.Black
cell.SetFontColor(color)
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#]
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#]
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")
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 | @ |
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#]
DataTable dataTable = new DataTable();
dataTable.Columns.Add("Column a",System.Type.GetType("System.String"));
dataTable.Columns.Add("Column b");
dataTable.Columns.Add("Column c");
dataTable.Columns.Add("Column d",System.Type.GetType("System.Double"));
dataTable.Columns.Add("Column e",System.Type.GetType("System.Int32"));
dataTable.Columns.Add("Column f",System.Type.GetType("System.Int32"));
DataTable exportTable = gridDesktop.Worksheets[0].Export(dataTable,1,0,10,6,true);
DataGrid1.SetDataBinding(exportTable, null);
[VB]
Dim dataTable As DataTable = New DataTable()
dataTable.Columns.Add("Column a",System.Type.GetType("System.String"))
dataTable.Columns.Add("Column b")
dataTable.Columns.Add("Column c")
dataTable.Columns.Add("Column d",System.Type.GetType("System.Double"))
dataTable.Columns.Add("Column e",System.Type.GetType("System.Int32"))
dataTable.Columns.Add("Column f",System.Type.GetType("System.Int32"))
Dim exportTable As DataTable = GridDesktop.Worksheets(0).Export(dataTable,1,0,10,6,True)
DataGrid1.SetDataBinding(exportTable)
[C#]
DataTable exportTable = gridDesktop.Worksheets[0].Export(0,0,10,2,true,false);
DataGrid1.SetDataBinding(exportTable, null);
[VB]
Dim exportTable As DataTable = GridDesktop.Worksheets(0).Export(0,0,10,2,True,False)
DataGrid1.SetDataBinding(exportTable)
[C#]
GridWeb1.DefaultFontName = "Arial";
[Visual Basic]
GridWeb1.DefaultFontName = "Arial"
[C#]
onErrorActionQuery.OnErrorAction = OnErrorActionType.Ignore;
[VB]
onErrorActionQuery.OnErrorAction = OnErrorActionType.Ignore
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.