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

Safe HaskellNone
LanguageHaskell2010

Codec.Xlsx.Types

Contents

Synopsis

The main types

data Xlsx #

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

Constructors

Xlsx 

Fields

Instances
Eq Xlsx # 
Instance details

Defined in Codec.Xlsx.Types

Methods

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

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

Show Xlsx # 
Instance details

Defined in Codec.Xlsx.Types

Methods

showsPrec :: Int -> Xlsx -> ShowS #

show :: Xlsx -> String #

showList :: [Xlsx] -> ShowS #

Generic Xlsx # 
Instance details

Defined in Codec.Xlsx.Types

Associated Types

type Rep Xlsx :: * -> * #

Methods

from :: Xlsx -> Rep Xlsx x #

to :: Rep Xlsx x -> Xlsx #

Default Xlsx # 
Instance details

Defined in Codec.Xlsx.Types

Methods

def :: Xlsx #

NFData Xlsx # 
Instance details

Defined in Codec.Xlsx.Types

Methods

rnf :: Xlsx -> () #

type Rep Xlsx # 
Instance details

Defined in Codec.Xlsx.Types

newtype Styles #

Constructors

Styles 

Fields

Instances
Eq Styles # 
Instance details

Defined in Codec.Xlsx.Types

Methods

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

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

Show Styles # 
Instance details

Defined in Codec.Xlsx.Types

Generic Styles # 
Instance details

Defined in Codec.Xlsx.Types

Associated Types

type Rep Styles :: * -> * #

Methods

from :: Styles -> Rep Styles x #

to :: Rep Styles x -> Styles #

NFData Styles # 
Instance details

Defined in Codec.Xlsx.Types

Methods

rnf :: Styles -> () #

type Rep Styles # 
Instance details

Defined in Codec.Xlsx.Types

type Rep Styles = D1 (MetaData "Styles" "Codec.Xlsx.Types" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" True) (C1 (MetaCons "Styles" PrefixI True) (S1 (MetaSel (Just "unStyles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString)))

newtype DefinedNames #

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)] 
Instances
Eq DefinedNames # 
Instance details

Defined in Codec.Xlsx.Types

Show DefinedNames # 
Instance details

Defined in Codec.Xlsx.Types

Generic DefinedNames # 
Instance details

Defined in Codec.Xlsx.Types

Associated Types

type Rep DefinedNames :: * -> * #

Default DefinedNames # 
Instance details

Defined in Codec.Xlsx.Types

Methods

def :: DefinedNames #

NFData DefinedNames # 
Instance details

Defined in Codec.Xlsx.Types

Methods

rnf :: DefinedNames -> () #

type Rep DefinedNames # 
Instance details

Defined in Codec.Xlsx.Types

type Rep DefinedNames = D1 (MetaData "DefinedNames" "Codec.Xlsx.Types" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" True) (C1 (MetaCons "DefinedNames" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(Text, Maybe Text, Text)])))

data ColumnsProperties #

Column range (from cwMin to cwMax) properties

Constructors

ColumnsProperties 

Fields

  • cpMin :: Int

    First column affected by this ColumnWidth record.

  • cpMax :: Int

    Last column affected by this ColumnWidth record.

  • cpWidth :: Maybe Double

    Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.

    See longer description in Section 18.3.1.13 "col (Column Width & Formatting)" (p. 1605)

  • cpStyle :: Maybe Int

    Default style for the affected column(s). Affects cells not yet allocated in the column(s). In other words, this style applies to new columns.

  • cpHidden :: Bool

    Flag indicating if the affected column(s) are hidden on this worksheet.

  • cpCollapsed :: Bool

    Flag indicating if the outlining of the affected column(s) is in the collapsed state.

  • cpBestFit :: Bool

    Flag indicating if the specified column(s) is set to 'best fit'.

Instances
Eq ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

Show ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

Generic ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

Associated Types

type Rep ColumnsProperties :: * -> * #

NFData ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

Methods

rnf :: ColumnsProperties -> () #

FromXenoNode ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

FromCursor ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

ToElement ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

type Rep ColumnsProperties # 
Instance details

Defined in Codec.Xlsx.Types

data PageSetup #

Constructors

PageSetup 

Fields

Instances
Eq PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

Ord PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

Show PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

Generic PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

Associated Types

type Rep PageSetup :: * -> * #

Default PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

Methods

def :: PageSetup #

NFData PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

Methods

rnf :: PageSetup -> () #

FromXenoNode PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

FromCursor PageSetup #

See CT_PageSetup, p. 3922

Instance details

Defined in Codec.Xlsx.Types.PageSetup

Methods

fromCursor :: Cursor -> [PageSetup] #

ToElement PageSetup #

See CT_PageSetup, p. 3922

Instance details

Defined in Codec.Xlsx.Types.PageSetup

Methods

toElement :: Name -> PageSetup -> Element #

type Rep PageSetup # 
Instance details

Defined in Codec.Xlsx.Types.PageSetup

type Rep PageSetup = D1 (MetaData "PageSetup" "Codec.Xlsx.Types.PageSetup" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" False) (C1 (MetaCons "PageSetup" PrefixI True) ((((S1 (MetaSel (Just "_pageSetupBlackAndWhite") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Bool)) :*: S1 (MetaSel (Just "_pageSetupCellComments") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe CellComments))) :*: (S1 (MetaSel (Just "_pageSetupCopies") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int)) :*: S1 (MetaSel (Just "_pageSetupDraft") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Bool)))) :*: ((S1 (MetaSel (Just "_pageSetupErrors") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe PrintErrors)) :*: S1 (MetaSel (Just "_pageSetupFirstPageNumber") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int))) :*: (S1 (MetaSel (Just "_pageSetupFitToHeight") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int)) :*: (S1 (MetaSel (Just "_pageSetupFitToWidth") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int)) :*: S1 (MetaSel (Just "_pageSetupHorizontalDpi") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int)))))) :*: (((S1 (MetaSel (Just "_pageSetupId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "_pageSetupOrientation") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Orientation))) :*: (S1 (MetaSel (Just "_pageSetupPageOrder") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe PageOrder)) :*: (S1 (MetaSel (Just "_pageSetupPaperHeight") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "_pageSetupPaperSize") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe PaperSize))))) :*: ((S1 (MetaSel (Just "_pageSetupPaperWidth") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Text)) :*: S1 (MetaSel (Just "_pageSetupScale") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int))) :*: (S1 (MetaSel (Just "_pageSetupUseFirstPageNumber") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Bool)) :*: (S1 (MetaSel (Just "_pageSetupUsePrinterDefaults") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Bool)) :*: S1 (MetaSel (Just "_pageSetupVerticalDpi") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int))))))))

data Worksheet #

Xlsx worksheet

Instances
Eq Worksheet # 
Instance details

Defined in Codec.Xlsx.Types

Show Worksheet # 
Instance details

Defined in Codec.Xlsx.Types

Generic Worksheet # 
Instance details

Defined in Codec.Xlsx.Types

Associated Types

type Rep Worksheet :: * -> * #

Default Worksheet # 
Instance details

Defined in Codec.Xlsx.Types

Methods

def :: Worksheet #

NFData Worksheet # 
Instance details

Defined in Codec.Xlsx.Types

Methods

rnf :: Worksheet -> () #

type Rep Worksheet # 
Instance details

Defined in Codec.Xlsx.Types

type Rep Worksheet = D1 (MetaData "Worksheet" "Codec.Xlsx.Types" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" False) (C1 (MetaCons "Worksheet" PrefixI True) (((S1 (MetaSel (Just "_wsColumnsProperties") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ColumnsProperties]) :*: (S1 (MetaSel (Just "_wsRowPropertiesMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map Int RowProperties)) :*: S1 (MetaSel (Just "_wsCells") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 CellMap))) :*: ((S1 (MetaSel (Just "_wsDrawing") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Drawing)) :*: S1 (MetaSel (Just "_wsMerges") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Range])) :*: (S1 (MetaSel (Just "_wsSheetViews") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe [SheetView])) :*: S1 (MetaSel (Just "_wsPageSetup") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe PageSetup))))) :*: ((S1 (MetaSel (Just "_wsConditionalFormattings") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map SqRef ConditionalFormatting)) :*: (S1 (MetaSel (Just "_wsDataValidations") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map SqRef DataValidation)) :*: S1 (MetaSel (Just "_wsPivotTables") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [PivotTable]))) :*: ((S1 (MetaSel (Just "_wsAutoFilter") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe AutoFilter)) :*: S1 (MetaSel (Just "_wsTables") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Table])) :*: (S1 (MetaSel (Just "_wsProtection") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe SheetProtection)) :*: S1 (MetaSel (Just "_wsSharedFormulas") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map SharedFormulaIndex SharedFormulaOptions)))))))

type CellMap = Map (Int, Int) Cell #

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 #

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

Instances
Eq CellValue # 
Instance details

Defined in Codec.Xlsx.Types.Common

Ord CellValue # 
Instance details

Defined in Codec.Xlsx.Types.Common

Show CellValue # 
Instance details

Defined in Codec.Xlsx.Types.Common

Generic CellValue # 
Instance details

Defined in Codec.Xlsx.Types.Common

Associated Types

type Rep CellValue :: * -> * #

NFData CellValue # 
Instance details

Defined in Codec.Xlsx.Types.Common

Methods

rnf :: CellValue -> () #

type Rep CellValue # 
Instance details

Defined in Codec.Xlsx.Types.Common

data CellFormula #

Formula for the cell.

TODO: array, dataTable formula types support

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

Constructors

CellFormula 

Fields

Instances
Eq CellFormula # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Show CellFormula # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Generic CellFormula # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep CellFormula :: * -> * #

NFData CellFormula # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Methods

rnf :: CellFormula -> () #

ToElement CellFormula # 
Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep CellFormula # 
Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep CellFormula = D1 (MetaData "CellFormula" "Codec.Xlsx.Types.Cell" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" 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 #

formula type with type-specific options

newtype SharedFormulaIndex #

index of shared formula in worksheet's wsSharedFormulas property

Constructors

SharedFormulaIndex Int 
Instances
Eq SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Ord SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Show SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Generic SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep SharedFormulaIndex :: * -> * #

NFData SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Methods

rnf :: SharedFormulaIndex -> () #

FromAttrBs SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

FromAttrVal SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

ToAttrVal SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep SharedFormulaIndex # 
Instance details

Defined in Codec.Xlsx.Types.Cell

type Rep SharedFormulaIndex = D1 (MetaData "SharedFormulaIndex" "Codec.Xlsx.Types.Cell" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" True) (C1 (MetaCons "SharedFormulaIndex" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

data Cell #

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

Instances
Eq Cell # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Methods

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

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

Show Cell # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Methods

showsPrec :: Int -> Cell -> ShowS #

show :: Cell -> String #

showList :: [Cell] -> ShowS #

Generic Cell # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Associated Types

type Rep Cell :: * -> * #

Methods

from :: Cell -> Rep Cell x #

to :: Rep Cell x -> Cell #

Default Cell # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Methods

def :: Cell #

NFData Cell # 
Instance details

Defined in Codec.Xlsx.Types.Cell

Methods

rnf :: Cell -> () #

type Rep Cell # 
Instance details

Defined in Codec.Xlsx.Types.Cell

data RowHeight #

Height of a row in points (1/72in)

Constructors

CustomHeight !Double

Row height is set by the user

AutomaticHeight !Double

Row height is set automatically by the program

Instances
Eq RowHeight # 
Instance details

Defined in Codec.Xlsx.Types

Ord RowHeight # 
Instance details

Defined in Codec.Xlsx.Types

Read RowHeight # 
Instance details

Defined in Codec.Xlsx.Types

Show RowHeight # 
Instance details

Defined in Codec.Xlsx.Types

Generic RowHeight # 
Instance details

Defined in Codec.Xlsx.Types

Associated Types

type Rep RowHeight :: * -> * #

NFData RowHeight # 
Instance details

Defined in Codec.Xlsx.Types

Methods

rnf :: RowHeight -> () #

type Rep RowHeight # 
Instance details

Defined in Codec.Xlsx.Types

type Rep RowHeight = D1 (MetaData "RowHeight" "Codec.Xlsx.Types" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" False) (C1 (MetaCons "CustomHeight" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double)) :+: C1 (MetaCons "AutomaticHeight" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double)))

data RowProperties #

Properties of a row. See §18.3.1.73 "row (Row)" for more details

Constructors

RowProps 

Fields

Instances
Eq RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

Ord RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

Read RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

Show RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

Generic RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

Associated Types

type Rep RowProperties :: * -> * #

Default RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

Methods

def :: RowProperties #

NFData RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

Methods

rnf :: RowProperties -> () #

type Rep RowProperties # 
Instance details

Defined in Codec.Xlsx.Types

type Rep RowProperties = D1 (MetaData "RowProperties" "Codec.Xlsx.Types" "xlsx-0.7.2-LJxbVm4yJQxBp0QchhVN6B" False) (C1 (MetaCons "RowProps" PrefixI True) (S1 (MetaSel (Just "rowHeight") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe RowHeight)) :*: (S1 (MetaSel (Just "rowStyle") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Int)) :*: S1 (MetaSel (Just "rowHidden") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool))))

Lenses

Workbook

Worksheet

Cells

Style helpers

renderStyleSheet :: StyleSheet -> Styles #

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 #

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.

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

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 #

reverse to toRows