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
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 A | Column B | Node path | Worksheet name |
|---|
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
The
Exceptions
ArgumentException
Thrown if the worksheet does not exist.