xlsx-1.1.4: Simple and incomplete Excel file parser/writer

Safe Haskell | None
Language | Haskell2010

Codec.Xlsx.Types.Cell

Synopsis

- data CellFormula = CellFormula {
  - _cellfExpression :: FormulaExpression
  - _cellfAssignsToName :: Bool
  - _cellfCalculate :: Bool
  }
- data FormulaExpression
  - = NormalFormula Formula
  - | SharedFormula SharedFormulaIndex
- simpleCellFormula :: Text -> CellFormula
- sharedFormulaByIndex :: SharedFormulaIndex -> CellFormula
- newtype SharedFormulaIndex = SharedFormulaIndex Int
- data SharedFormulaOptions = SharedFormulaOptions {
  - _sfoRef :: CellRef
  - _sfoExpression :: Formula
  }
- formulaDataFromCursor :: Cursor -> [(CellFormula, Maybe (SharedFormulaIndex, SharedFormulaOptions))]
- applySharedFormulaOpts :: SharedFormulaOptions -> Element -> Element
- data Cell = Cell {
  - _cellStyle :: Maybe Int
  - _cellValue :: Maybe CellValue
  - _cellComment :: Maybe Comment
  - _cellFormula :: Maybe CellFormula
  }
- cellStyle :: Lens' Cell (Maybe Int)
- cellValue :: Lens' Cell (Maybe CellValue)
- cellComment :: Lens' Cell (Maybe Comment)
- cellFormula :: Lens' Cell (Maybe CellFormula)
- type CellMap = Map (RowIndex, ColumnIndex) Cell

# Documentation

data CellFormula Source #

Formula for the cell.

TODO: array, dataTable formula types support

See 18.3.1.40 "f (Formula)" (p. 1636)

Constructors

CellFormula |

Fields

- _cellfExpression :: FormulaExpression
- _cellfAssignsToName :: Bool

  Specifies that this formula assigns a value to a name.

- _cellfCalculate :: Bool

  Indicates that this formula needs to be recalculated the next time calculation is performed. [Example: This is always set on volatile functions, like =RAND(), and circular references. end example]

#### Instances

Instances details

NFData CellFormula Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods rnf :: CellFormula -> () Source #
Generic CellFormula Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep CellFormula |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep CellFormula = D1 ('MetaData "CellFormula" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "CellFormula" 'PrefixI 'True) (S1 ('MetaSel ('Just "_cellfExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FormulaExpression) :*: (S1 ('MetaSel ('Just "_cellfAssignsToName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_cellfCalculate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

Methods

from :: CellFormula -> Rep CellFormula x Source #

to :: Rep CellFormula x -> CellFormula Source #

Show CellFormula Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods showsPrec :: Int -> CellFormula -> ShowS Source # show :: CellFormula -> String Source # showList :: [CellFormula] -> ShowS Source #
Eq CellFormula Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods (==) :: CellFormula -> CellFormula -> Bool Source # (/=) :: CellFormula -> CellFormula -> Bool Source #
ToElement CellFormula Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods toElement :: Name -> CellFormula -> Element Source #
type Rep CellFormula Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep CellFormula = D1 ('MetaData "CellFormula" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "CellFormula" 'PrefixI 'True) (S1 ('MetaSel ('Just "_cellfExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FormulaExpression) :*: (S1 ('MetaSel ('Just "_cellfAssignsToName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_cellfCalculate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

data FormulaExpression Source #

formula type with type-specific options

Constructors

NormalFormula Formula |
SharedFormula SharedFormulaIndex |

#### Instances

Instances details

NFData FormulaExpression Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods rnf :: FormulaExpression -> () Source #
Generic FormulaExpression Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep FormulaExpression |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep FormulaExpression = D1 ('MetaData "FormulaExpression" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "NormalFormula" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Formula)) :+: C1 ('MetaCons "SharedFormula" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SharedFormulaIndex)))

Methods

from :: FormulaExpression -> Rep FormulaExpression x Source #

to :: Rep FormulaExpression x -> FormulaExpression Source #

Show FormulaExpression Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods showsPrec :: Int -> FormulaExpression -> ShowS Source # show :: FormulaExpression -> String Source # showList :: [FormulaExpression] -> ShowS Source #
Eq FormulaExpression Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods (==) :: FormulaExpression -> FormulaExpression -> Bool Source # (/=) :: FormulaExpression -> FormulaExpression -> Bool Source #
type Rep FormulaExpression Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep FormulaExpression = D1 ('MetaData "FormulaExpression" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "NormalFormula" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Formula)) :+: C1 ('MetaCons "SharedFormula" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SharedFormulaIndex)))

simpleCellFormula :: Text -> CellFormula Source #

sharedFormulaByIndex :: SharedFormulaIndex -> CellFormula Source #

newtype SharedFormulaIndex Source #

index of shared formula in worksheet's `wsSharedFormulas` property

Constructors

SharedFormulaIndex Int |

#### Instances

Instances details

NFData SharedFormulaIndex Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods rnf :: SharedFormulaIndex -> () Source #
Generic SharedFormulaIndex Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep SharedFormulaIndex |
Instance details Defined in Codec.Xlsx.Types.Cell type Rep SharedFormulaIndex = D1 ('MetaData "SharedFormulaIndex" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'True) (C1 ('MetaCons "SharedFormulaIndex" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

Methods

from :: SharedFormulaIndex -> Rep SharedFormulaIndex x Source #

to :: Rep SharedFormulaIndex x -> SharedFormulaIndex Source #

Show SharedFormulaIndex Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods showsPrec :: Int -> SharedFormulaIndex -> ShowS Source # show :: SharedFormulaIndex -> String Source # showList :: [SharedFormulaIndex] -> ShowS Source #
Eq SharedFormulaIndex Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods (==) :: SharedFormulaIndex -> SharedFormulaIndex -> Bool Source # (/=) :: SharedFormulaIndex -> SharedFormulaIndex -> Bool Source #
Ord SharedFormulaIndex Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

Methods

compare :: SharedFormulaIndex -> SharedFormulaIndex -> Ordering Source #

(<) :: SharedFormulaIndex -> SharedFormulaIndex -> Bool Source #

(<=) :: SharedFormulaIndex -> SharedFormulaIndex -> Bool Source #

(>) :: SharedFormulaIndex -> SharedFormulaIndex -> Bool Source #

(>=) :: SharedFormulaIndex -> SharedFormulaIndex -> Bool Source #

max :: SharedFormulaIndex -> SharedFormulaIndex -> SharedFormulaIndex Source #

min :: SharedFormulaIndex -> SharedFormulaIndex -> SharedFormulaIndex Source #

FromAttrVal SharedFormulaIndex Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods fromAttrVal :: Reader SharedFormulaIndex Source #
FromAttrBs SharedFormulaIndex Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods fromAttrBs :: ByteString -> Either Text SharedFormulaIndex Source #
ToAttrVal SharedFormulaIndex Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods toAttrVal :: SharedFormulaIndex -> Text Source #
type Rep SharedFormulaIndex Source # |
Instance details Defined in Codec.Xlsx.Types.Cell type Rep SharedFormulaIndex = D1 ('MetaData "SharedFormulaIndex" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'True) (C1 ('MetaCons "SharedFormulaIndex" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

data SharedFormulaOptions Source #

Constructors

SharedFormulaOptions |

Fields

- _sfoRef :: CellRef
- _sfoExpression :: Formula

#### Instances

Instances details

NFData SharedFormulaOptions Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods rnf :: SharedFormulaOptions -> () Source #
Generic SharedFormulaOptions Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep SharedFormulaOptions |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep SharedFormulaOptions = D1 ('MetaData "SharedFormulaOptions" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "SharedFormulaOptions" 'PrefixI 'True) (S1 ('MetaSel ('Just "_sfoRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CellRef) :*: S1 ('MetaSel ('Just "_sfoExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Formula)))

Methods

from :: SharedFormulaOptions -> Rep SharedFormulaOptions x Source #

to :: Rep SharedFormulaOptions x -> SharedFormulaOptions Source #

Show SharedFormulaOptions Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods showsPrec :: Int -> SharedFormulaOptions -> ShowS Source # show :: SharedFormulaOptions -> String Source # showList :: [SharedFormulaOptions] -> ShowS Source #
Eq SharedFormulaOptions Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods (==) :: SharedFormulaOptions -> SharedFormulaOptions -> Bool Source # (/=) :: SharedFormulaOptions -> SharedFormulaOptions -> Bool Source #
type Rep SharedFormulaOptions Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep SharedFormulaOptions = D1 ('MetaData "SharedFormulaOptions" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "SharedFormulaOptions" 'PrefixI 'True) (S1 ('MetaSel ('Just "_sfoRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CellRef) :*: S1 ('MetaSel ('Just "_sfoExpression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Formula)))

formulaDataFromCursor :: Cursor -> [(CellFormula, Maybe (SharedFormulaIndex, SharedFormulaOptions))] Source #

applySharedFormulaOpts :: SharedFormulaOptions -> Element -> Element Source #

data Cell Source #

Currently cell details include cell values, style ids and cell formulas (inline strings from `<is>` subelements are ignored)

Constructors

Cell |

Fields

- _cellStyle :: Maybe Int
- _cellValue :: Maybe CellValue
- _cellComment :: Maybe Comment
- _cellFormula :: Maybe CellFormula

#### Instances

Instances details

Default Cell Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods def :: Cell Source #
NFData Cell Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods rnf :: Cell -> () Source #
Generic Cell Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep Cell |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep Cell = D1 ('MetaData "Cell" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "Cell" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_cellStyle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "_cellValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CellValue))) :*: (S1 ('MetaSel ('Just "_cellComment") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Comment)) :*: S1 ('MetaSel ('Just "_cellFormula") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CellFormula)))))

Methods

from :: Cell -> Rep Cell x Source #

to :: Rep Cell x -> Cell Source #

Show Cell Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods showsPrec :: Int -> Cell -> ShowS Source # show :: Cell -> String Source # showList :: [Cell] -> ShowS Source #
Eq Cell Source # |
Instance details Defined in Codec.Xlsx.Types.Cell Methods (==) :: Cell -> Cell -> Bool Source # (/=) :: Cell -> Cell -> Bool Source #
type Rep Cell Source # |

Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep Cell = D1 ('MetaData "Cell" "Codec.Xlsx.Types.Cell" "xlsx-1.1.4-G0KawmQS4mL8oRGRTaTy8Y" 'False) (C1 ('MetaCons "Cell" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_cellStyle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "_cellValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CellValue))) :*: (S1 ('MetaSel ('Just "_cellComment") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Comment)) :*: S1 ('MetaSel ('Just "_cellFormula") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe CellFormula)))))

cellStyle :: Lens' Cell (Maybe Int) Source #

cellValue :: Lens' Cell (Maybe CellValue) Source #

cellComment :: Lens' Cell (Maybe Comment) Source #

cellFormula :: Lens' Cell (Maybe CellFormula) Source #

type CellMap = Map (RowIndex, ColumnIndex) Cell Source #

Map containing cell values which are indexed by row and column if you need to use more traditional (x,y) indexing please you could use corresponding accessors from '`Lens'`