Passa al contenuto principale

Class ExcelReader

Namespace: TecnoPack.TranslationsManager.Excel
Assembly: CO0002_Templ_FlowpackHMI_V00_26_M.dll

Reads translation dictionaries from Excel worksheets.

public sealed class ExcelReader

Inheritance

object ← ExcelReader

Constructors

ExcelReader(string)

Initializes a new instance of .

public ExcelReader(string filePath)

Parameters

filePath string

The path to the Excel file to read.

Exceptions

ArgumentNullException

Thrown if filePath is null or empty.

ExcelReader(Stream)

Initializes a new instance of from a stream.

public ExcelReader(Stream stream)

Parameters

stream Stream

The stream containing the Excel file data.

Remarks

The stream must be readable and positioned at the beginning of the Excel content. This constructor is ideal for scenarios where the file is received via an API or loaded from memory.

Exceptions

ArgumentNullException

Thrown if stream is null.

Methods

GetLookupDictionary()

Reads the lookup worksheet from the current Excel workbook and returns a dictionary mapping worksheet names to their corresponding node paths.

<remarks> The expected format of the lookup sheet is:
Column AColumn BNode pathWorksheet name
Empty rows or invalid entries are ignored. </remarks>

public Dictionary<string, string> GetLookupDictionary()

Returns

Dictionary<string, string>

A dictionary where the key is the worksheet name and the value is the node path.

Exceptions

ArgumentException

Thrown if the lookup worksheet cannot be found.

ReadWorksheet(string)

Reads a worksheet into a .

public TranslationDictionary ReadWorksheet(string sheetName)

Parameters

sheetName string

The worksheet name to read.

Returns

TranslationDictionary

The extracted from the worksheet.

Exceptions

ArgumentException

Thrown if the worksheet does not exist.

  • Constructors
    • ExcelReader(string)
    • ExcelReader(Stream)
  • Methods
    • GetLookupDictionary()
    • ReadWorksheet(string)