packages feed

xlsx 0.2.2.1 → 0.2.2.2

raw patch · 7 files changed

+27/−15 lines, 7 files

Files

CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.2.2.2+-----+* fixed missing from parsing code font family value 0 (Not applicable) (thanks Steve Bigham <steve.bigham@gmail.com>)+* fixed time type used in haddock example (thanks Manoj <manoj.p.gudi@gmail.com>)+ 0.2.2.1 ----- * fixed comments data type names and modules/imports
src/Codec/Xlsx.hs view
@@ -24,11 +24,11 @@ -- > import Codec.Xlsx -- > import Control.Lens -- > import qualified Data.ByteString.Lazy as L--- > import System.Time+-- > import Data.Time.Clock.POSIX -- > -- > main :: IO () -- > main = do--- >   ct <- getClockTime+-- >   ct <- getPOSIXTime -- >   let -- >       sheet = def & cellValueAt (1,2) ?~ CellDouble 42.0 -- >                   & cellValueAt (3,2) ?~ CellText "foo"
src/Codec/Xlsx/Types/Common.hs view
@@ -1,11 +1,13 @@ {-# LANGUAGE OverloadedStrings  #-} module Codec.Xlsx.Types.Common        ( CellRef+       , SqRef (..)        , XlsxText (..)        ) where  import qualified Data.Map                   as Map import           Data.Text                  (Text)+import qualified Data.Text                  as T import           Text.XML import           Text.XML.Cursor @@ -18,6 +20,9 @@ -- see 18.18.62 @ST_Ref@ (p. 2482) type CellRef = Text +newtype SqRef = SqRef [CellRef]+    deriving (Eq, Ord, Show)+ -- | Common type containing either simple string or rich formatted text. -- Used in @si@, @comment@ and @is@ elements --@@ -55,6 +60,11 @@           XlsxRichText rich -> map (toElement "r") rich     } +-- | A sequence of cell references, space delimited.+-- See 18.18.76, "ST_Sqref (Reference Sequence)", p. 2488.+instance ToAttrVal SqRef where+    toAttrVal (SqRef refs) = T.intercalate " " refs+ {-------------------------------------------------------------------------------   Parsing -------------------------------------------------------------------------------}@@ -76,3 +86,6 @@         return $ XlsxRichText rs       _ ->         fail "invalid item"++instance FromAttrVal SqRef where+    fromAttrVal t = readSuccess (SqRef $ T.split (== ' ') t)
src/Codec/Xlsx/Types/SheetViews.hs view
@@ -51,12 +51,9 @@ import Control.Lens (makeLenses) import Data.Default import Data.Maybe (catMaybes, maybeToList, listToMaybe)-import Data.Text (Text)-import qualified Data.Text as T import Text.XML import Text.XML.Cursor import qualified Data.Map  as Map-import qualified Data.Text as Text  #if !MIN_VERSION_base(4,8,0) import Control.Applicative@@ -202,7 +199,7 @@   , _selectionPane :: Maybe PaneType      -- | Range of the selection. Can be non-contiguous set of ranges.-  , _selectionSqref :: Maybe [CellRef]+  , _selectionSqref :: Maybe SqRef   }   deriving (Show, Eq, Ord) @@ -419,14 +416,9 @@           "pane"         .=? _selectionPane         , "activeCell"   .=? _selectionActiveCell         , "activeCellId" .=? _selectionActiveCellId-        , "sqref"        .=? (spaceDelim <$> _selectionSqref)+        , "sqref"        .=? _selectionSqref         ]     }-    where-      -- The @sqref@ is a space delimited list-      -- See 18.18.76, "ST_Sqref (Reference Sequence)", p. 2488.-      spaceDelim :: [Text] -> Text-      spaceDelim = Text.intercalate " "  -- | See @CT_Pane@, p. 3913 instance ToElement Pane where@@ -506,7 +498,7 @@     _selectionPane         <- maybeAttribute "pane" cur     _selectionActiveCell   <- maybeAttribute "activeCell" cur     _selectionActiveCellId <- maybeAttribute "activeCellId" cur-    _selectionSqref        <- fmap (T.split (== ' ')) <$> maybeAttribute "sqref" cur+    _selectionSqref        <- maybeAttribute "sqref" cur     return Selection{..}  -- | See @ST_SheetViewType@, p. 3913
src/Codec/Xlsx/Types/StyleSheet.hs view
@@ -1254,7 +1254,9 @@     _fontScheme       <- maybeElementValue (n"scheme") cur     return Font{..} +-- | See 18.18.94 "ST_FontFamily (Font Family)" (p. 2517) instance FromAttrVal FontFamily where+  fromAttrVal "0" = readSuccess FontFamilyNotApplicable   fromAttrVal "1" = readSuccess FontFamilyRoman   fromAttrVal "2" = readSuccess FontFamilySwiss   fromAttrVal "3" = readSuccess FontFamilyModern
test/DataTest.hs view
@@ -66,7 +66,7 @@                      & sheetViewSelection .~ [ def & selectionActiveCell .~ Just "C2"                                                    & selectionPane .~ Just PaneTypeBottomRight                                              , def & selectionActiveCellId .~ Just 1-                                                   & selectionSqref .~ Just ["A3:A10","B1:G3"]+                                                   & selectionSqref ?~ SqRef ["A3:A10","B1:G3"]                                              ]     pageSetup = Just $ def & pageSetupBlackAndWhite .~ Just True                            & pageSetupCopies .~ Just 2
xlsx.cabal view
@@ -1,6 +1,6 @@ Name:                xlsx -Version:             0.2.2.1+Version:             0.2.2.2  Synopsis:            Simple and incomplete Excel file parser/writer Description: