xlsx-0.6.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 #

Generic Xlsx Source # 

Associated Types

type Rep Xlsx :: * -> * #

Methods

from :: Xlsx -> Rep Xlsx x #

to :: Rep Xlsx x -> Xlsx #

Default Xlsx Source # 

Methods

def :: Xlsx #

type Rep Xlsx Source # 

newtype Styles Source #

Constructors

Styles 

Fields

Instances

Eq Styles Source # 

Methods

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

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

Show Styles Source # 
Generic Styles Source # 

Associated Types

type Rep Styles :: * -> * #

Methods

from :: Styles -> Rep Styles x #

to :: Rep Styles x -> Styles #

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

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 ColumnsProperties Source #

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 Source # 
Show ColumnsProperties Source # 
Generic ColumnsProperties Source # 
ToElement ColumnsProperties Source # 
FromCursor ColumnsProperties Source # 
type Rep ColumnsProperties Source # 

data PageSetup Source #

Constructors

PageSetup 

Fields

Instances

Eq PageSetup Source # 
Ord PageSetup Source # 
Show PageSetup Source # 
Generic PageSetup Source # 

Associated Types

type Rep PageSetup :: * -> * #

Default PageSetup Source # 

Methods

def :: PageSetup #

ToElement PageSetup Source #

See CT_PageSetup, p. 3922

FromCursor PageSetup Source #

See CT_PageSetup, p. 3922

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

data Worksheet Source #

Xlsx worksheet

Instances

Eq Worksheet Source # 
Show Worksheet Source # 
Generic Worksheet Source # 

Associated Types

type Rep Worksheet :: * -> * #

Default Worksheet Source # 

Methods

def :: Worksheet #

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

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 cell values, style ids and cell formulas (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 #

Generic Cell Source # 

Associated Types

type Rep Cell :: * -> * #

Methods

from :: Cell -> Rep Cell x #

to :: Rep Cell x -> Cell #

Default Cell Source # 

Methods

def :: Cell #

type Rep Cell Source # 

data RowHeight Source #

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

data RowProperties Source #

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

Constructors

RowProps 

Fields

Instances

Eq RowProperties Source # 
Ord RowProperties Source # 
Read RowProperties Source # 
Show RowProperties Source # 
Generic RowProperties Source # 

Associated Types

type Rep RowProperties :: * -> * #

Default RowProperties Source # 

Methods

def :: RowProperties #

type Rep RowProperties Source # 

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.

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