Visual Basic (Declaration) | |
---|---|
Public Function Cells( _ ByVal start As DDCell, _ ByVal end As DDCell _ ) As DDCells |
Parameters
- start
- The DDCell showing the cell position of starting point.
- end
- The DDCell showing the cell position of ending point.
C# | Copy Code |
---|---|
private void Form1_Load(object sender, System.EventArgs e) { // Add a sheet to the Sheets collection of the Workbook. GrapeCity.SpreadBuilder.Workbook sb = new GrapeCity.SpreadBuilder.Workbook(); sb.Sheets.AddNew(); // Set the properties, values, for columns, rows, and cells. sb.Sheets[0].Name = "Customer Call List"; sb.Sheets[0].Columns(0).Width = 2 * 1440; sb.Sheets[0].Columns(1).Width = 1440; sb.Sheets[0].Columns(2).Width = 1440; sb.Sheets[0].Rows(0).Height = 1440/4; // Header row sb.Sheets[0].Cell(0,0).SetValue("Company Name"); sb.Sheets[0].Cell(0,1).SetValue("Department Name"); sb.Sheets[0].Cell(0,2).SetValue("Phone Number"); // Data for the first row sb.Sheets[0].Cell(1,0).SetValue("Grapecity"); sb.Sheets[0].Cell(1,1).SetValue("Sales Department"); sb.Sheets[0].Cell(1,2).SetValue("(022) 777-8210"); //Specify the cell range and set the format sb.Sheets[0].Cells(sb.Sheets[0].Cell(0, 0), sb.Sheets[0].Cell(0, 2)).FontBold = true; sb.Sheets[0].Cells(sb.Sheets[0].Cell(0, 0), sb.Sheets[0].Cell(1, 2)).FontName = "MS UI Gothic"; // Save the Workbook to an Excel file. sb.Save (Application.StartupPath + @"\x.xls"); MessageBox.Show(Application.StartupPath + @"Saved to" + "\x.xls."); } |
Visual Basic | Copy Code |
---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Add a sheet to the Sheets collection of the Workbook. Dim sb As New GrapeCity.SpreadBuilder.Workbook() sb.Sheets.AddNew() ' Set the properties, values, for columns, rows, and cells. With sb.Sheets(0) .Name = "Customer Call List" .Columns(0).Width = 2 * 1440 .Columns(1).Width = 1440 .Columns(2).Width = 1440 .Rows(0).Height = 1440 / 4 ' Header row .Cell(0, 0).SetValue("Company Name") .Cell(0, 1).SetValue("Department Name") .Cell(0, 2).SetValue("Phone Number") ' Data for the first row .Cell(1, 0).SetValue("Grapecity") .Cell(1, 1).SetValue("Sales Department") .Cell(1, 2).SetValue("(022) 777-8210") End With ' Specify the cell range and set the format sb.Sheets(0).Cells(sb.Sheets(0).Cell(0, 0), sb.Sheets(0).Cell(0, 2)).FontBold = True sb.Sheets(0).Cells(sb.Sheets(0).Cell(0, 0), sb.Sheets(0).Cell(1, 2)).FontName = "MS UI Gothic" ' Save the Workbook to an Excel file. sb.Save(Application.StartupPath & "\x.xls") MsgBox(Application.StartupPath & "Saved to" & "\x.xls") End Sub |