This module implements XLSX (Excel) file export functionality for test data within the DTS.Serialization framework. It extends Serialization.File and implements IWritable<Test> to provide structured export of Test objects to Excel spreadsheets. The module supports exporting engineering units (EU), millivolt (mV), and analog-to-digital converter (ADC) values based on configurable flags, and includes support for filtered/unfiltered data, time-based slicing (Start/Stop), and user-selected export headers. It uses the DocumentFormat.OpenXml library to generate compliant XLSX files, leveraging a template file (XLSXExportTemplate.xlsx) and performing two-pass writing: first for metadata/headers, then for numeric data using SAX-style streaming for performance.
-
internal File WriterParent { get; }
Reference to the owning File instance.
-
public bool ExportADC { get; set; }
Gets or sets whether to export raw ADC values.
-
public bool ExportEU { get; set; }
Gets or sets whether to export engineering units (EU) values. Default is true.
-
public bool ExportMv { get; set; }
Gets or sets whether to export millivolt (mV) values.
-
public double Start { get; set; }
Start time (in seconds) for data slicing.
-
public double Stop { get; set; }
Stop time (in seconds) for data slicing.
-
public bool Filtered { get; set; }
Indicates whether filtered data should be exported.
-
public List<IExportHeader> ExportHeaders { get; set; }
List of user-selected headers to include in the export (FB 6410). Only headers with IsSelected == true are written.
-
public void Write(string pathname, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)
Note: This method is declared but has no body in the provided source. Likely a legacy or stub signature.
-
public void Write(string pathname, string id, string dataFolder, Test test, bool bFiltering, bool includeGroupNameInISOExport, FilteredData fd, Test.Module.Channel tmChannel, int channelNumber, BeginEventHandler beginEventHandler, CancelEventHandler cancelEventHandler, EndEventHandler endEventHandler, TickEventHandler tickEventHandler, ErrorEventHandler errorEventHandler, CancelRequested cancelRequested, double minStartTime, int dataCollectionLength)
Main export method. Writes a Test object to an XLSX file at pathname. Performs:
- Template file copy and OpenXML document opening.
- Header row indexing via
_headerRowLineIndex (FB 6410).
- Metadata writing (test date/time, ID, description, channel info, scaling, filter settings).
- Data scaling via
GetDataScaler and precomputation of scalers in _aicToScaler.
- Optional filtering of EU data using
SaeJ211Filter.
- Two-pass writing: first pass writes headers/metadata; second pass streams data using SAX-style
OpenXmlReader/OpenXmlWriter.
- Interpolation for resampling channels with different sample rates.
- Progress updates every 1000 samples (
UPDATE_INTERVAL).
- Cleanup: unsets channel data, logs errors, invokes event handlers.
-
public static Common.DAS.Concepts.DataScaler GetDataScaler(Test.Module.AnalogInputChannel currentAnalogChannel)
Constructs and configures a DataScaler instance from an AnalogInputChannel, including linearization, scaling factors, zero methods, digital channel settings (FB 14469), and excitation voltage properties.
-
protected Cell GetCell(Worksheet worksheet, string xColumn, uint rowIndex, bool bLookForCell = true)
Retrieves or inserts a cell at the specified location. Uses _rowIndexToRow cache for performance.
-
private static Cell InsertCellInWorksheet(string columnName, uint rowIndex, WorksheetPart worksheetPart, string cellReference, bool bLookForCell)
Inserts a cell into the worksheet, maintaining OpenXML cell ordering by CellReference.
-
private void WriteTime(WorksheetPart ws, string column, uint row, DateTime time, SharedStringTablePart sharedString)
Writes a time value as a shared string with number format ID 14 (time format).
-
private void WriteTime(WorksheetPart ws, string column, string headerName, DateTime time, SharedStringTablePart sharedString)
Overload that writes to the row index associated with headerName (FB 6410).
-
private void WriteDate(WorksheetPart ws, string column, uint row, DateTime date)
Writes a date as an OLE Automation date (OADate) with number format.
-
private void WriteDate(WorksheetPart ws, string column, string headerName, DateTime date)
Overload that writes to the row index associated with headerName (FB 6410).
-
private void WriteDouble(WorksheetPart ws, string column, uint row, double value)
Writes a numeric value directly to a cell.
-
private void WriteDouble(WorksheetPart ws, string column, string headerName, double value)
Overload that writes to the row index associated with headerName (FB 6410).
-
private void WriteString(WorksheetPart ws, string column, uint row, SharedStringTablePart sharedStringTablePart, string value)
Writes a string as a shared string.
-
private void WriteString(WorksheetPart ws, string column, string headerName, SharedStringTablePart sharedStringTablePart, string value)
Overload that writes to the row index associated with headerName (FB 6410). Skips duplicate entries via _alreadyEnteredHeader.
-
private int InsertSharedStringItem(string text, SharedStringTablePart shareStringPart)
Adds or retrieves a shared string index. Uses _stringLookup dictionary for O(1) lookup.
-
private static string GetColumn(int index)
Converts a zero-based column index to Excel column letters (e.g., 0 → "B"). Starts at column B (index 0 → "B").
-
private void AddStyleSheet(SpreadsheetDocument sp)
Adds a date/time number format (ID 14) to the stylesheet and caches its index in _dateFormatIndex.
-
private void InsertRow(WorksheetPart worksheetPart)
Inserts an empty row after the last row in the worksheet.
-
private void UpdateProgress(double dValue, TickEventHandler tickEventHandler)
Invokes the progress event handler if non-null.
-
internal Writer(File fileType, int encoding)
Constructor initializing Writer base class, setting default export flags (ExportEU = true, others false), and storing WriterParent.
-
public void Initialize(...)
Note: This method is declared but has no body in the provided source. Likely a stub or unused legacy method.