diff --git a/src/FsSpreadsheet.ExcelIO/FsExtensions.fs b/src/FsSpreadsheet.ExcelIO/FsExtensions.fs index 68585fb7..70855167 100644 --- a/src/FsSpreadsheet.ExcelIO/FsExtensions.fs +++ b/src/FsSpreadsheet.ExcelIO/FsExtensions.fs @@ -78,7 +78,8 @@ module FsExtensions = static member fromXlsxTable table = let topLeftBoundary, bottomRightBoundary = Table.getArea table |> Table.Area.toBoundaries let ra = FsRangeAddress(FsAddress(topLeftBoundary), FsAddress(bottomRightBoundary)) - FsTable(table.Name, ra, table.TotalsRowShown, true) + let totalsRowShown = if table.TotalsRowShown = null then false else table.TotalsRowShown.Value + FsTable(table.Name, ra, totalsRowShown, true) /// /// Returns the FsWorksheet associated with the FsTable in a given FsWorkbook. diff --git a/tests/FsSpreadsheet.ExcelIO.Tests/FsSpreadsheet.ExcelIO.Tests.fsproj b/tests/FsSpreadsheet.ExcelIO.Tests/FsSpreadsheet.ExcelIO.Tests.fsproj index 735a8349..480cb7b9 100644 --- a/tests/FsSpreadsheet.ExcelIO.Tests/FsSpreadsheet.ExcelIO.Tests.fsproj +++ b/tests/FsSpreadsheet.ExcelIO.Tests/FsSpreadsheet.ExcelIO.Tests.fsproj @@ -14,6 +14,7 @@ + diff --git a/tests/FsSpreadsheet.ExcelIO.Tests/Table.fs b/tests/FsSpreadsheet.ExcelIO.Tests/Table.fs new file mode 100644 index 00000000..4803a568 --- /dev/null +++ b/tests/FsSpreadsheet.ExcelIO.Tests/Table.fs @@ -0,0 +1,25 @@ +module FsTable + +open Expecto +open FsSpreadsheet +open FsSpreadsheet.ExcelIO +open DocumentFormat.OpenXml +open TestingUtils + + +let transformTable = + testList "transformTable" [ + testCase "handleNullFields" (fun () -> + let table = FsSpreadsheet.ExcelIO.Table.create "TestTable" (StringValue ("A1:D4")) [] + Expect.isTrue (table.TotalsRowShown = null) "Check that field of interest is None" + FsTable.fromXlsxTable table |> ignore + ) + + ] + + +[] +let main = + testList "FsTable" [ + transformTable + ]