Skip to content

Commit

Permalink
Specify code snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
omaus authored Jul 27, 2023
1 parent 53b109c commit 5ed3752
Showing 1 changed file with 16 additions and 34 deletions.
50 changes: 16 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,22 @@ spreadsheet.ToFile(excelFilePath)
## Code Examples

```fsharp
let parseWorkbook wb =
let tables = getAnnotationTables wb
let worksheets = wb.GetWorksheets()
// get worksheet and its AnnotationTable as tuple
let worksheetsAndTables =
tables
|> List.map (
fun t ->
let associatedWs =
worksheets
|> List.find (
fun ws ->
ws.Tables
|> List.exists (fun t2 -> t2.Name = t.Name)
)
associatedWs, t
)
worksheetsAndTables
|> List.map (
fun (ws,t) ->
let headerCells = getHeaderCellsOf ws.CellCollection t |> List.ofSeq
let ioColumns =
headerCells
|> List.map (parseIOColumns ws.CellCollection t)
let termRelatedBuildingBlocks =
headerCells
|> groupTermRelatedBuildingBlocks t ws.CellCollection
|> List.map (parseTermRelatedBuildingBlocks true t ws.CellCollection)
ws.Name,
{|
IOColumns = ioColumns
TermRelatedBuildingBlocks = termRelatedBuildingBlocks
|}
)
let tables = workbook.GetTables()
let worksheets = workbook.GetWorksheets()
// get worksheet and its table as tuple
let worksheetsAndTables =
tables
|> List.map (
fun t ->
let associatedWs =
worksheets
|> List.find (
fun ws ->
ws.Tables
|> List.exists (fun t2 -> t2.Name = t.Name)
)
associatedWs, t
)
```


Expand Down

0 comments on commit 5ed3752

Please sign in to comment.