CadWorkbook
from OpenCAD2D import CadWorkbook
class CadWorkbook(System.Object) ยท CadWorkbook in the .NET reference
An Excel workbook of the .xlsx kind (Office Open XML), read and written by the presenter's own small code, with no Excel and no other package: its sheets and named ranges, the values the file holds (a formula gives the value last worked out and kept with it, no formula is evaluated), shared and inline texts, numbers shown as their formats show them, dates, and a cell's alignment, fill and font colour. A workbook of the older .xls kind is not read.
Properties and fields
NamedRanges
@property
def NamedRanges(self) -> System.Collections.Generic.IReadOnlyDictionary[str, str]
Gets the named ranges of the workbook, each name with the cells it names as the workbook writes them, Sheet1!$A$1:$C$5; a name of a formula or of a sheet's own scope is not among them.
SheetNames
@property
def SheetNames(self) -> System.Collections.Generic.IReadOnlyList[str]
Gets the names of the sheets, in the order of the workbook's tabs.
Methods
Open
@staticmethod
def Open(path: str) -> CadWorkbook
Opens a workbook.
ReadSheet
def ReadSheet(self, name: str) -> CadSheet
Reads a sheet.
Write
@staticmethod
def Write(path: str, sheetName: str, sheet: CadSheet) -> None
Writes a new workbook of one sheet, as a data extraction writes its .xlsx file: texts as inline strings, numbers and booleans as values, a date as its number under the date format of the workbook's own styles.
WriteBack
@staticmethod
def WriteBack(path: str, sheetName: str, topRow: int, leftColumn: int, values: CadSheet) -> int
Writes cells into a sheet of a workbook, as AutoCAD writes a data link's cells back to its source: each cell of values put at its place from the first cell given, a text as an inline string and a number as a value; every other part of the workbook, its styles, its other sheets and its formulas, kept as it was. A cell that holds a formula is left as it is.