nfdi4plants / ARCtrl

Library for management of Annotated Research Contexts (ARCs) using an in-memory representation and runtime-agnostic contract systems.
MIT License
11 stars 7 forks source link

[BUG] Writing xlsx files looses numberFormat info #81

Open Freymaurer opened 1 year ago

Freymaurer commented 1 year ago

Describe the bug I am working on a function to write swate tables from a extern data type. The function looks like this:

/// tables is the external datatype parsed to `Assay`
let assay =  Export.parseBuildingBlockSeqsToAssay tables
let a = QueryModel.QAssay.fromAssay assay
let wb = 
    workbook {
        for (i,s) in List.indexed a.Sheets do QSheet.toSheet i s
        sheet "Assay" {
            for r in MetaData.toDSLSheet assay [] do r
        }
    }
/// Parsing unit is not done correctly.
let fsSpreadsheet = wb.Value.Parse().ToBytes()

Most code is taken from here https://github.com/nfdi4plants/ISADotNet/blob/a06af930e4d3f9d3c49a7b07bb0496f927c4e6cc/src/ISADotNet.XLSX/AssayFile/Assay.fs#L188

If i try to write Swate unit columns, the final .xlsx file does not contain any numberFormat information. All cells have DataType string, even though it should be something like this "0.00 \"unit\"".

Image shows Cell.DataType and Cell.Value image

If i convert my assay to json with the following code, all unit information is still there, so i assume the information is lost somwhere in ISADotNet to SpreadsheetFs

/// tables is the external datatype parsed to `Assay`
let assay =  Export.parseBuildingBlockSeqsToAssay tables
let parsedJsonStr = ISADotNet.Json.Assay.toString assay
// no unit information lost.
HLWeil commented 9 months ago

Dependent on https://github.com/fslaborg/FsSpreadsheet/issues/21