OpenXmlExcelWorkerProvider

Ecng.Excel

The IExcelWorkerProvider implementation based on Open XML SDK. It can open and modify an existing XLSX template (keeping styles, charts, conditional formatting), and only inject new values into cells.

Implements: IExcelWorkerProvider

Methods

CreateNew
public IExcelWorker CreateNew(Stream stream, bool readOnly)
result = openXmlExcelWorkerProvider.CreateNew(stream, readOnly)

Creates a new Excel workbook and returns an IExcelWorker instance to interact with it.

stream
The stream to write the new workbook to.
readOnly
If true, the workbook is opened in read-only mode; otherwise, it is writable.

Returns: An IExcelWorker instance for the new workbook.

OpenExist
public IExcelWorker OpenExist(Stream stream)
result = openXmlExcelWorkerProvider.OpenExist(stream)

Opens an existing Excel workbook from a stream and returns an IExcelWorker instance to interact with it.

stream
The stream containing the existing workbook data.

Returns: An IExcelWorker instance for the opened workbook.