Table of Contents

CadDataSource

from OpenCAD2D import CadDataSource

class CadDataSource(System.Object) ยท CadDataSource in the .NET reference

Where the data of a data link is, as AutoCAD's Excel data adapter (AcExcel) words it in the connection string of a link: the file, then ! and the sheet, then ! and the range, parts.xlsx!Sheet1!A1:C5; the file and the sheet alone for the entire sheet, parts.xlsx!Sheet1; the file and a name for a named range, parts.xlsx!Prices. A file is an .xlsx workbook or a .csv file; a relative path is of the drawing's folder.

Properties and fields

ExcelAdapter

.NET

ExcelAdapter: ClassVar[str]

The data adapter of a link to a spreadsheet, as AutoCAD names it.

Methods

Compose

.NET

@staticmethod
def Compose(file: str, sheet: str, range: str) -> str

Puts a connection string together.

Describe

.NET

@staticmethod
def Describe(connection: str) -> str

What a connection string links, in the words of the Data Link Manager's details: Entire sheet: Sheet1, Named range: Prices or Range: A1:C5.

Read

.NET

@staticmethod
def Read(connection: str, drawingFolder: str) -> CadSheet

Reads what a connection string links. A workbook's sheet by its name, else its named range, else (for a file of one sheet, a CSV file) the file's own sheet; the cells of a range cut from the sheet, whole columns to the sheet's last row.

Resolve

.NET

@staticmethod
def Resolve(file: str, drawingFolder: str) -> str

Where a file of a connection string is: itself where it is a full path, else in the folder of the drawing; null where it is relative and the drawing has no folder yet.

TryParse

.NET

@staticmethod
def TryParse(connection: str) -> tuple[bool, str, str, str]

Takes a connection string apart: the file and what follows its extension.

Write

.NET

@staticmethod
def Write(connection: str, drawingFolder: str, values: CadSheet) -> int

Writes cells back to what a connection string links, from its first cell: a CSV file is written whole again (its other cells kept), a workbook has the cells put into its sheet and every other part left as it is.