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

Safe HaskellNone
LanguageHaskell2010

Codec.Xlsx.Types

Contents

Synopsis

The main types

data Xlsx Source #

Structured representation of Xlsx file (currently a subset of its contents)

Instances

Eq Xlsx Source # 

Methods

(==) :: Xlsx -> Xlsx -> Bool #

(/=) :: Xlsx -> Xlsx -> Bool #

Show Xlsx Source # 

Methods

showsPrec :: Int -> Xlsx -> ShowS #

show :: Xlsx -> String #

showList :: [Xlsx] -> ShowS #

Default Xlsx Source # 

Methods

def :: Xlsx #

newtype Styles Source #

Constructors

Styles 

Fields

Instances

newtype DefinedNames Source #

Defined names

Each defined name consists of a name, an optional local sheet ID, and a value.

This element defines the collection of defined names for this workbook. Defined names are descriptive names to represent cells, ranges of cells, formulas, or constant values. Defined names can be used to represent a range on any worksheet.

Excel also defines a number of reserved names with a special interpretation:

  • _xlnm.Print_Area specifies the workbook's print area. Example value: SheetName!$A:$A,SheetName!$1:$4
  • _xlnm.Print_Titles specifies the row(s) or column(s) to repeat at the top of each printed page.
  • _xlnm.Sheet_Title:refers to a sheet title.

and others. See Section 18.2.6, "definedNames (Defined Names)" (p. 1728) of the spec (second edition).

NOTE: Right now this is only a minimal implementation of defined names.

Constructors

DefinedNames [(Text, Maybe Text, Text)] 

data PageSetup Source #

Constructors

PageSetup 

Fields

data Worksheet Source #

Xlsx worksheet

Constructors

Worksheet 

Fields

type CellMap = Map (Int, Int) 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'

data CellValue Source #

Cell values include text, numbers and booleans, standard includes date format also but actually dates are represented by numbers with a date format assigned to a cell containing it

data CellFormula Source #

Formula for the cell.

TODO: array. dataTable and shared formula types support

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

Constructors

NormalCellFormula 

Fields

  • _cellfExpression :: Formula
     
  • _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]

data Cell Source #

Currently cell details include only cell values and style ids (e.g. formulas from <f> and inline strings from <is> subelements are ignored)

Instances

Eq Cell Source # 

Methods

(==) :: Cell -> Cell -> Bool #

(/=) :: Cell -> Cell -> Bool #

Show Cell Source # 

Methods

showsPrec :: Int -> Cell -> ShowS #

show :: Cell -> String #

showList :: [Cell] -> ShowS #

Default Cell Source # 

Methods

def :: Cell #

type Range = Text Source #

Excel range (e.g. D13:H14)

Lenses

Workbook

Worksheet

Cells

Style helpers

renderStyleSheet :: StyleSheet -> Styles Source #

Render StyleSheet

This is used to render a structured StyleSheet into a raw XML Styles document. Actually replacing Styles with StyleSheet would mean we would need to write a parser for StyleSheet as well (and would moreover require that we support the full style sheet specification, which is still quite a bit of work).

parseStyleSheet :: Styles -> Either SomeException StyleSheet Source #

Parse StyleSheet

This is used to parse raw Styles into structured StyleSheet currently not all of the style sheet specification is supported so parser (and the data model) is to be completed

Misc

def :: Default a => a #

The default value for this type.

mkRange :: (Int, Int) -> (Int, Int) -> Range Source #

Render range

mkRange (2, 4) (6, 8) == "D2:H6"

fromRange :: Range -> ((Int, Int), (Int, Int)) Source #

reverse to mkRange

Warning: the function isn't total and will throw an error if incorrect value will get passed

toRows :: CellMap -> [(Int, [(Int, Cell)])] Source #

converts cells mapped by (row, column) into rows which contain row index and cells as pairs of column indices and cell values

fromRows :: [(Int, [(Int, Cell)])] -> CellMap Source #

reverse to toRows