Skip to content

Commit

Permalink
Update testCells to have their real values instead of SST index
Browse files Browse the repository at this point in the history
  • Loading branch information
omaus committed Mar 13, 2023
1 parent 31bdfa9 commit c1d54b2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/FsSpreadsheet.ExcelIO.Tests/Spreadsheet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ let sstpFox = wbpFox.SharedStringTablePart
let sstFox = sstpFox.SharedStringTable
let sstFoxInnerText = sstFox.InnerText
let wsp1Fox = (wbpFox.WorksheetParts |> Array.ofSeq)[0]
let cbsi1Fox = wsp1Fox.Worksheet.Descendants<Spreadsheet.Cell>() |> Array.ofSeq
let cbsi1Fox = // get the Cells, but with their real values (inferred from the SST) not their SST index
wsp1Fox.Worksheet.Descendants<Spreadsheet.Cell>()
|> Array.ofSeq
|> Array.map (
fun c ->
if c.DataType <> null && c.DataType.Value = Spreadsheet.CellValues.SharedString then
let index = int c.CellValue.InnerText
let item = sstFox.Elements<OpenXmlElement>() |> Seq.item index
let value = item.InnerText
c.CellValue.Text <- value
c
else
c
)


//let testSsdFox2 = Packaging.SpreadsheetDocument.Open(testFilePath, false)
Expand Down

0 comments on commit c1d54b2

Please sign in to comment.