Neues Arbeitsblatt erstellen
Contents
[
Hide
]
Aspose.Cells - Neues Arbeitsblatt erstellen
C#
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Workbook object
WorksheetCollection worksheets = workbook.Worksheets;
Worksheet worksheet = worksheets.Add("My Worksheet");
//Saving the Excel file
workbook.Save("newWorksheet.xls");
NPOI - HSSF XSSF - Neues Arbeitsblatt erstellen
C#
IWorkbook wb = new XSSFWorkbook();
ISheet sheet1 = wb.CreateSheet("First Sheet");
ISheet sheet2 = wb.CreateSheet("Second Sheet");
// Note that sheet name is Excel must not exceed 31 characters
// and must not contain any of the any of the following characters:
// 0x0000
// 0x0003
// colon (:)
// backslash (\)
// asterisk (*)
// question mark (?)
// forward slash (/)
// opening square bracket ([)
// closing square bracket (])
// You can use org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)}
// for a safe way to create valid names, this utility replaces invalid characters with a space (' ')
String safeName = WorkbookUtil.CreateSafeSheetName("[O'Brien's sales*?]");
ISheet sheet3 = wb.CreateSheet(safeName);
FileStream sw = File.Create("newWorksheet.xls");
wb.Write(sw);
sw.Close();
Laufenden Code herunterladen
Laden Sie das Erstellen eines neuen Arbeitsblatts von einer der unten genannten sozialen Codeseiten herunter:
Für weitere Details besuchen Sie Arbeiten mit Tabellenblättern.