HExcel 0.1.0.0 → 0.1.0.1
raw patch · 8 files changed
+78/−92 lines, 8 filesdep ~base
Dependency ranges changed: base
Files
- .DS_Store binary
- ._.DS_Store binary
- CHANGELOG.md +0/−5
- HExcel.cabal +4/−3
- README.md +0/−53
- package.yaml +0/−27
- src/Main.hs +74/−0
- stack.yaml +0/−4
− .DS_Store
binary file changed (6148 → absent bytes)
− ._.DS_Store
binary file changed (120 → absent bytes)
− CHANGELOG.md
@@ -1,5 +0,0 @@-# Revision history for HExcel--## 0.1.0.0 -- YYYY-mm-dd--* First version. Released on an unsuspecting world.
HExcel.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 62133125a83cd855af0e3dd872fb71b2de059d93bef1b7f5504ad003a4115eb7+-- hash: 92f52ac66ce8347642d971d8f2f8d5bf9caf622cdc47d5e03f4e7f82359cc75e name: HExcel-version: 0.1.0.0+version: 0.1.0.1 synopsis: Create Excel files with Haskell description: Easily create Excel files with Haskell. See README at <https://github.com/green-lambda/HExcel> category: Data, Text, SpreadSheet@@ -24,6 +24,7 @@ HExcel.Ffi HExcel.HExcelInternal HExcel.Types+ Main Paths_HExcel hs-source-dirs: src@@ -32,7 +33,7 @@ z xlsxwriter build-depends:- base >=4.5 && <4.13+ base >=4.5 && <5 , microlens , microlens-th , time
− README.md
@@ -1,53 +0,0 @@-# HExcel-Create Excel files with Haskell---------------------------------------------------------------------------------This is a fork of [libxlsxwriter](https://github.com/HalfWayMan/libxlsxwriter)-that tries the improve on the api and provide a library for-creation of Excel files.-Underneath the hood it uses C library called [libxlsxwriter](http://libxlsxwriter.github.io/) and provides-bindings to C code to produce Excel 2007+ xlsx files.--## Example--```-{-# LANGUAGE TypeApplications #-}-module Main where--import Control.Monad.Trans.State (execStateT)-import Control.Monad (forM_)-import Data.Time (getZonedTime)-import HExcel--main :: IO ()-main = do- wb <- workbookNew "test.xlsx"- let props = mkDocProperties- { docPropertiesTitle = "Test Workbook"- , docPropertiesCompany = "HExcel"- }- workbookSetProperties wb props- ws <- workbookAddWorksheet wb "First Sheet"- df <- workbookAddFormat wb- formatSetNumFormat df "mmm d yyyy hh:mm AM/PM"- now <- getZonedTime- -- You can create HExcelState which is convenient api for writing to cells - let initState = HExcelState Nothing ws 4 1 0 1 0- _ <- flip execStateT initState $ do- writeCell "David"- writeCell "Dimitrije"- -- we can skip some rows- skipRows 1- writeCell "Jovana"- -- or skip some columns- skipCols 1- writeCell (zonedTimeToDateTime now)- writeCell @Double 42.5-- -- or use functions that run in plain IO- forM_ [5 .. 8] $ \n -> do- writeString ws Nothing n 3 "xxx"- writeNumber ws Nothing n 4 1234.56- writeDateTime ws (Just df) n 5 (zonedTimeToDateTime now)- workbookClose wb--```
− package.yaml
@@ -1,27 +0,0 @@-name: HExcel-version: 0.1.0.0-synopsis: Create Excel files with Haskell-author: Sasha Bogicevic-maintainer: sasa.bogicevic@pm.me-license: BSD3-build-type: Simple-description: Easily create Excel files with Haskell. See README at <https://github.com/green-lambda/HExcel>-category: Data, Text, SpreadSheet--dependencies:- - base >= 4.5 && < 4.13- - transformers- - time- - microlens- - microlens-th--ghc-options: -Wall--library:- exposed-modules:- - HExcel- source-dirs:- - src- extra-libraries:- - z- - xlsxwriter
+ src/Main.hs view
@@ -0,0 +1,74 @@+{-# LANGUAGE TypeApplications #-}+module Main where++import Control.Monad.Trans.State (execStateT)+import Control.Monad (forM_)+import Control.Monad.IO.Class+import Data.Time (getZonedTime)+import HExcel++-- #!/usr/bin/env stack+-- stack script --resolver lts-14.9 --package=HExcel++-- import HExcel++main = do+ wb <- workbookNew "buggy-dates.xls"+ let props = mkDocProperties+ { docPropertiesTitle = "Buggy Dates"+ , docPropertiesCompany = ""+ }+ workbookSetProperties wb props+ ws <- workbookAddWorksheet wb "Buggy Dates"+ df <- workbookAddFormat wb+ formatSetNumFormat df "mm/dd/yy hh:mm AM/PM"+ sequence_ [+ writeDateTime+ ws+ (Just df)+ (fromIntegral (day - 1) * 24 + fromIntegral hour)+ 0+ (DateTime 2019 11 day hour 0 0)+ | day <- [1..30], hour <- [0..23]+ ]+ workbookClose wb++-- main :: IO ()+-- main = do+-- wb <- workbookNew "test.xlsx"+-- let props = mkDocProperties+-- { docPropertiesTitle = "Test Workbook"+-- , docPropertiesCompany = "HExcel"+-- }+-- workbookSetProperties wb props+-- ws <- workbookAddWorksheet wb "First Sheet"+-- df <- workbookAddFormat wb+-- formatSetNumFormat df "mmm d yyyy hh:mm AM/PM"+-- now <- getZonedTime+-- writeDateTime ws (Just df) n 5 (zonedTimeToDateTime now)+-- -- You can create HExcelState which is convenient api for writing to cells+-- let initState = HExcelState Nothing ws 4 1 0 1 0+-- _ <- flip execStateT initState $ do+-- writeCell "David"+-- writeCell "Dimitrije"++-- liftIO $ writeDateTime ws (Just df) 1 5 (zonedTimeToDateTime now)+-- liftIO $ writeDateTime ws (Just df) 2 6 (zonedTimeToDateTime now)+-- liftIO $ writeDateTime ws (Just df) 3 7 (zonedTimeToDateTime now)+-- liftIO $ writeDateTime ws (Just df) 4 8 (zonedTimeToDateTime now)+-- liftIO $ writeDateTime ws (Just df) 5 9 (zonedTimeToDateTime now)+-- liftIO $ writeDateTime ws (Just df) 6 10 (zonedTimeToDateTime now)+-- -- we can skip some rows+-- skipRows 1+-- writeCell "Jovana"+-- -- skip some columns+-- skipCols 1+-- writeCell (zonedTimeToDateTime now)+-- writeCell @Double 42.5++-- -- or use functions that run in plain IO+-- -- forM_ [5 .. 8] $ \n -> do+-- -- writeString ws Nothing n 3 "xxx"+-- -- writeNumber ws Nothing n 4 1234.56+-- -- writeDateTime ws (Just df) n 5 (zonedTimeToDateTime now)+-- workbookClose wb
− stack.yaml
@@ -1,4 +0,0 @@-resolver: lts-13.26--packages:-- .