public class Workbook extends Object implements AutoClosable:
XLSX workbook reader and writer.
The writer produces a real OpenXML workbook with worksheets, column widths, inline string cells, numeric cells, boolean cells and simple cell formats. Reading currently supports uncompressed ZIP entries, which includes files produced by this writer through Klyn's ZipArchiver.
@example `klyn import klyn.io.xlsx
try workbook = Workbook("spies.xlsx", WorkbookMode.CREATE): sheet = workbook.addWorksheet("Spies") sheet.write("A1", "James")
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | sheetCountsheetCount as Int: |
Number of worksheets in the workbook. |
| public readonly property | worksheetsworksheets as WorkbookWorksheets: |
Ordered worksheet collection. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | WorkbookWorkbook(filePath as String, mode as WorkbookMode = WorkbookMode.READ) throws IOException: |
Creates or reads a workbook. |
| public | WorkbookWorkbook(path as Path, mode as WorkbookMode = WorkbookMode.READ) throws IOException: |
Creates or reads a workbook. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | addChart | Creates a chart owned by this workbook. |
| public | addFormat | Adds a cell format to the workbook style table. |
| public | addWorksheet | Adds a worksheet. |
| public override | closeclose() as Void throws IOException: |
Closes the workbook. |
| public | savesave() as Void throws IOException: |
Writes the workbook to its configured path. |
| public | savesave(filePath as String) as Void throws IOException: |
Writes the workbook to a specific path. |
| public | worksheet | Returns a worksheet by zero-based index. |
| public | worksheet | Returns a worksheet by name. |