qrilka / xlsx

Simple and incomplete Excel file parser/writer
MIT License
128 stars 62 forks source link

Empty stylesheet improvements #136

Closed qrilka closed 3 years ago

qrilka commented 3 years ago

Resolves #134

qrilka commented 3 years ago

@dten I've invited you to become a collaborator on this project (otherwise I can't assign you to review this :) )

qrilka commented 3 years ago

@dten do you have a minute to take a look into this?

dten commented 3 years ago

I will this evening sorry

qrilka commented 3 years ago

There's no particular rush but will you have a moment for it in one of upcoming days?

qrilka commented 3 years ago

Hi @dten I guess you don't have time for this thus I'll merge this tomorrow even if there will be no feedback from you.

dten commented 3 years ago

Really sorry! Just been busy with work. I'll really really try have a look tonight

dten commented 3 years ago

😅 was just testing this and it does fix the problem i was getting. the below now produces a file Excel will open whereas before it would not

{-# LANGUAGE OverloadedStrings #-}

module Main where

import Codec.Xlsx
import Control.Lens
import qualified Data.ByteString.Lazy as L
import Data.Time.Clock.POSIX

main :: IO ()
main = do
  ct <- getPOSIXTime
  let
      sheet = def & cellValueAt (1,2) ?~ CellDouble 42.0
                  & cellValueAt (3,2) ?~ CellText "foo"
      xlsx = def & (atSheet "List1" ?~ sheet)
                 & (xlStyles .~ renderStyleSheet def)
  L.writeFile "example.xlsx" $ fromXlsx ct xlsx