Last active
December 12, 2022 17:45
-
-
Save deemp/4d3fafd3885e9846814bf87287466d5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
example :: IO () | |
example = do | |
ct <- getPOSIXTime | |
let | |
name = "3" | |
ws = | |
X.def | |
& X.atCell (3, 2) ?~ X.Cell (Just 0) (Just $ X.CellDouble 42.0) Nothing Nothing | |
styleSheet = sheet | |
where | |
-- fill | |
red_ = X.def & X.colorARGB ?~ "ABABAB" | |
fill_ = | |
X.def | |
& X.fillPattern | |
?~ ( X.def | |
& X.fillPatternBgColor ?~ red_ | |
& X.fillPatternType ?~ X.PatternTypeSolid | |
) | |
(cellXF :: X.CellXf) = | |
X.def | |
& X.cellXfFillId ?~ 0 | |
& X.cellXfApplyFill ?~ True | |
& X.cellXfId ?~ 0 | |
sheet = | |
X.minimalStyleSheet | |
& X.styleSheetCellXfs .~ [cellXF] | |
& X.styleSheetFills .~ [fill_] | |
xlsx = | |
X.def | |
& X.atSheet "List1" ?~ ws | |
& X.xlStyles .~ X.renderStyleSheet styleSheet | |
L.writeFile ("example-" <> name <> ".xlsx") $ X.fromXlsx ct xlsx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment