Skip to content

Commit

Permalink
Merge pull request #52 from CSBiology/FsSpreadsheet.Exceljs
Browse files Browse the repository at this point in the history
FsSpreadsheet.Exceljs
  • Loading branch information
omaus committed Jul 31, 2023
2 parents 65174d9 + a680d45 commit e47262b
Show file tree
Hide file tree
Showing 41 changed files with 1,791 additions and 177 deletions.
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"commands": [
"fable"
]
},
"femto": {
"version": "0.19.0",
"commands": [
"femto"
]
}
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,7 @@ tmp/
.fsdocs/
/tests/FsSpreadsheet.JsNativeTests/fable/**/*.js
/js
/tests/FsSpreadsheet.Tests/js
/tests/JS/fable
/tests/JS/FsSpreadsheet.Exceljs
/tests/FsSpreadsheet.Exceljs.Tests/js
36 changes: 33 additions & 3 deletions FsSpreadsheet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F77AD108
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsSpreadsheet.Interactive.Tests", "tests\FsSpreadsheet.Interactive.Tests\FsSpreadsheet.Interactive.Tests.fsproj", "{7AC6357C-BDA0-40AE-955E-953C4BFF5BB0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FsSpreadsheet.JsNativeTests", "FsSpreadsheet.JsNativeTests", "{CA144336-9B18-429F-A11B-81EC3CB06CE5}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsSpreadsheet.Exceljs", "src\FsSpreadsheet.Exceljs\FsSpreadsheet.Exceljs.fsproj", "{E72A14FF-5026-463B-B0FA-2DA104D67B0C}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsSpreadsheet.Exceljs.Tests", "tests\FsSpreadsheet.Exceljs.Tests\FsSpreadsheet.Exceljs.Tests.fsproj", "{96E12F19-B25A-415E-B965-F9DE8D713C67}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JS", "JS", "{ADCF7D08-F2EE-4DFD-A96A-7E0134A1546F}"
ProjectSection(SolutionItems) = preProject
tests\FsSpreadsheet.JsNativeTests\Main.js = tests\FsSpreadsheet.JsNativeTests\Main.js
tests\JS\Exceljs.js = tests\JS\Exceljs.js
EndProjectSection
EndProject
Global
Expand Down Expand Up @@ -149,6 +153,30 @@ Global
{7AC6357C-BDA0-40AE-955E-953C4BFF5BB0}.Release|x64.Build.0 = Release|Any CPU
{7AC6357C-BDA0-40AE-955E-953C4BFF5BB0}.Release|x86.ActiveCfg = Release|Any CPU
{7AC6357C-BDA0-40AE-955E-953C4BFF5BB0}.Release|x86.Build.0 = Release|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Debug|x64.ActiveCfg = Debug|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Debug|x64.Build.0 = Debug|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Debug|x86.ActiveCfg = Debug|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Debug|x86.Build.0 = Debug|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Release|Any CPU.Build.0 = Release|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Release|x64.ActiveCfg = Release|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Release|x64.Build.0 = Release|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Release|x86.ActiveCfg = Release|Any CPU
{E72A14FF-5026-463B-B0FA-2DA104D67B0C}.Release|x86.Build.0 = Release|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Debug|x64.ActiveCfg = Debug|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Debug|x64.Build.0 = Debug|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Debug|x86.ActiveCfg = Debug|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Debug|x86.Build.0 = Debug|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Release|Any CPU.Build.0 = Release|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Release|x64.ActiveCfg = Release|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Release|x64.Build.0 = Release|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Release|x86.ActiveCfg = Release|Any CPU
{96E12F19-B25A-415E-B965-F9DE8D713C67}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -162,7 +190,9 @@ Global
{C7DF552E-DDE1-4D6D-B0A3-B9D273FC0E32} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{5F8EBA76-7B6B-4BAF-9426-F17B14FA5C4C} = {1CF1274C-DE28-4446-9B4E-5884E797B87B}
{7AC6357C-BDA0-40AE-955E-953C4BFF5BB0} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{CA144336-9B18-429F-A11B-81EC3CB06CE5} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{E72A14FF-5026-463B-B0FA-2DA104D67B0C} = {1CF1274C-DE28-4446-9B4E-5884E797B87B}
{96E12F19-B25A-415E-B965-F9DE8D713C67} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
{ADCF7D08-F2EE-4DFD-A96A-7E0134A1546F} = {F77AD108-C6B4-46BB-B7BC-13573F45F876}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0EDE6697-0F13-4DB1-AC56-12C15A72D395}
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,28 @@ spreadsheet.ToFile(excelFilePath)

![image](https://user-images.githubusercontent.com/17880410/167841765-f67e1fa2-3806-4f32-9223-bdecc8253568.png)

## Code Examples

```fsharp
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
)
```


## Develop

### Build QuickStart
Expand Down
46 changes: 2 additions & 44 deletions build/TestTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ open BasicTasks

[<Literal>]
let FableTestPath_input = "tests/FsSpreadsheet.Tests"
[<Literal>]
let FableTestPath_output = "tests/FsSpreadsheet.JsNativeTests/fable"

[<AutoOpen>]
module private Helper =
Expand Down Expand Up @@ -108,18 +106,15 @@ module private Helper =
|> Proc.Parallel.run
|> ignore

let cleanFable = BuildTask.create "cleanFable" [clean; build] {
System.IO.Directory.CreateDirectory FableTestPath_output |> ignore
run dotnet "fable clean --yes" FableTestPath_output
}

module RunTests =

/// runs `npm test` in root.
/// npm test consists of `test` and `pretest`
/// check package.json in root for behavior
let runTestsJs = BuildTask.create "runTestsJS" [clean; cleanFable; build] {
let runTestsJs = BuildTask.create "runTestsJS" [clean; build] {
run npm "test" ""
run npm "run testexceljs" ""
}

let runTestsDotnet = BuildTask.create "runTestsDotnet" [clean; build] {
Expand All @@ -138,41 +133,4 @@ module RunTests =

let runTests = BuildTask.create "RunTests" [clean; build; RunTests.runTestsJs; RunTests.runTestsDotnet] {
()
}

module WatchTests =

let private watchProjTests (projPath:string) =
let pName =
let n = System.IO.Path.GetFileNameWithoutExtension(projPath)
$"[{n}]"
pName, dotnet "watch run" projPath

let private dotnetTestsProcesses =
[
for testProj in testProjects do
yield watchProjTests testProj
]

let private fableTestsProcesses =
[
"[Fable]", dotnet $"fable watch {FableTestPath_input} -o {FableTestPath_output} -s --run npm run test:live" "."
"[Mocha]", npm $"run testnative:live" "."
]

let allTest = dotnetTestsProcesses@fableTestsProcesses

let watchTestsDotnet = BuildTask.create "watchTestsDotnet" [clean; build] {
dotnetTestsProcesses
|> runParallel
}

let watchJS = BuildTask.create "watchTestsJS" [clean; build] {
fableTestsProcesses
|> runParallel
}

let watchTests = BuildTask.create "watchTests" [clean; build] {
WatchTests.allTest
|> runParallel
}
Loading

0 comments on commit e47262b

Please sign in to comment.