| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Codec.Xlsx.Types
Synopsis
- data Xlsx = Xlsx {}
- newtype Styles = Styles {}
- newtype DefinedNames = DefinedNames [(Text, Maybe Text, Text)]
- data ColumnsProperties = ColumnsProperties {}
- data PageSetup = PageSetup {
- _pageSetupBlackAndWhite :: Maybe Bool
- _pageSetupCellComments :: Maybe CellComments
- _pageSetupCopies :: Maybe Int
- _pageSetupDraft :: Maybe Bool
- _pageSetupErrors :: Maybe PrintErrors
- _pageSetupFirstPageNumber :: Maybe Int
- _pageSetupFitToHeight :: Maybe Int
- _pageSetupFitToWidth :: Maybe Int
- _pageSetupHorizontalDpi :: Maybe Int
- _pageSetupId :: Maybe Text
- _pageSetupOrientation :: Maybe Orientation
- _pageSetupPageOrder :: Maybe PageOrder
- _pageSetupPaperHeight :: Maybe Text
- _pageSetupPaperSize :: Maybe PaperSize
- _pageSetupPaperWidth :: Maybe Text
- _pageSetupScale :: Maybe Int
- _pageSetupUseFirstPageNumber :: Maybe Bool
- _pageSetupUsePrinterDefaults :: Maybe Bool
- _pageSetupVerticalDpi :: Maybe Int
- data Worksheet = Worksheet {
- _wsColumnsProperties :: [ColumnsProperties]
- _wsRowPropertiesMap :: Map Int RowProperties
- _wsCells :: CellMap
- _wsDrawing :: Maybe Drawing
- _wsMerges :: [Range]
- _wsSheetViews :: Maybe [SheetView]
- _wsPageSetup :: Maybe PageSetup
- _wsConditionalFormattings :: Map SqRef ConditionalFormatting
- _wsDataValidations :: Map SqRef DataValidation
- _wsPivotTables :: [PivotTable]
- _wsAutoFilter :: Maybe AutoFilter
- _wsTables :: [Table]
- _wsProtection :: Maybe SheetProtection
- _wsSharedFormulas :: Map SharedFormulaIndex SharedFormulaOptions
- type CellMap = Map (Int, Int) Cell
- data CellValue
- data CellFormula = CellFormula {}
- data FormulaExpression
- newtype SharedFormulaIndex = SharedFormulaIndex Int
- data SharedFormulaOptions = SharedFormulaOptions {}
- data Cell = Cell {}
- data RowHeight
- data RowProperties = RowProps {}
- xlSheets :: Lens' Xlsx [(Text, Worksheet)]
- xlStyles :: Lens' Xlsx Styles
- xlDefinedNames :: Lens' Xlsx DefinedNames
- xlCustomProperties :: Lens' Xlsx (Map Text Variant)
- xlDateBase :: Lens' Xlsx DateBase
- wsColumnsProperties :: Lens' Worksheet [ColumnsProperties]
- wsRowPropertiesMap :: Lens' Worksheet (Map Int RowProperties)
- wsCells :: Lens' Worksheet CellMap
- wsDrawing :: Lens' Worksheet (Maybe Drawing)
- wsMerges :: Lens' Worksheet [Range]
- wsSheetViews :: Lens' Worksheet (Maybe [SheetView])
- wsPageSetup :: Lens' Worksheet (Maybe PageSetup)
- wsConditionalFormattings :: Lens' Worksheet (Map SqRef ConditionalFormatting)
- wsDataValidations :: Lens' Worksheet (Map SqRef DataValidation)
- wsPivotTables :: Lens' Worksheet [PivotTable]
- wsAutoFilter :: Lens' Worksheet (Maybe AutoFilter)
- wsTables :: Lens' Worksheet [Table]
- wsProtection :: Lens' Worksheet (Maybe SheetProtection)
- wsSharedFormulas :: Lens' Worksheet (Map SharedFormulaIndex SharedFormulaOptions)
- cellValue :: Lens' Cell (Maybe CellValue)
- cellStyle :: Lens' Cell (Maybe Int)
- cellComment :: Lens' Cell (Maybe Comment)
- cellFormula :: Lens' Cell (Maybe CellFormula)
- emptyStyles :: Styles
- renderStyleSheet :: StyleSheet -> Styles
- parseStyleSheet :: Styles -> Either SomeException StyleSheet
- simpleCellFormula :: Text -> CellFormula
- sharedFormulaByIndex :: SharedFormulaIndex -> CellFormula
- def :: Default a => a
- toRows :: CellMap -> [(Int, [(Int, Cell)])]
- fromRows :: [(Int, [(Int, Cell)])] -> CellMap
- module Codec.Xlsx.Types.Variant
- module Codec.Xlsx.Types.Table
- module Codec.Xlsx.Types.StyleSheet
- module Codec.Xlsx.Types.SheetViews
- module Codec.Xlsx.Types.RichText
- module Codec.Xlsx.Types.Protection
- module Codec.Xlsx.Types.PivotTable
- module Codec.Xlsx.Types.PageSetup
- module Codec.Xlsx.Types.Drawing.Common
- module Codec.Xlsx.Types.Drawing.Chart
- module Codec.Xlsx.Types.Drawing
- module Codec.Xlsx.Types.DataValidation
- module Codec.Xlsx.Types.ConditionalFormatting
- module Codec.Xlsx.Types.Common
- module Codec.Xlsx.Types.Comment
- module Codec.Xlsx.Types.AutoFilter
The main types
Structured representation of Xlsx file (currently a subset of its contents)
Constructors
| Xlsx | |
Fields
| |
Instances
| Eq Xlsx # | |
| Show Xlsx # | |
| Generic Xlsx # | |
| Default Xlsx # | |
Defined in Codec.Xlsx.Types | |
| NFData Xlsx # | |
Defined in Codec.Xlsx.Types | |
| type Rep Xlsx # | |
Defined in Codec.Xlsx.Types type Rep Xlsx = D1 (MetaData "Xlsx" "Codec.Xlsx.Types" "xlsx-0.7.2-JGGtT1sQysOJfkAOVHYL70" False) (C1 (MetaCons "Xlsx" PrefixI True) ((S1 (MetaSel (Just "_xlSheets") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(Text, Worksheet)]) :*: S1 (MetaSel (Just "_xlStyles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Styles)) :*: (S1 (MetaSel (Just "_xlDefinedNames") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DefinedNames) :*: (S1 (MetaSel (Just "_xlCustomProperties") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map Text Variant)) :*: S1 (MetaSel (Just "_xlDateBase") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 DateBase))))) | |
Constructors
| Styles | |
Fields | |
Instances
| Eq Styles # | |
| Show Styles # | |
| Generic Styles # | |
| NFData Styles # | |
Defined in Codec.Xlsx.Types | |
| type Rep Styles # | |
Defined in Codec.Xlsx.Types type Rep Styles = D1 (MetaData "Styles" "Codec.Xlsx.Types" "xlsx-0.7.2-JGGtT1sQysOJfkAOVHYL70" 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_Areaspecifies the workbook's print area. Example value:SheetName!$A:$A,SheetName!$1:$4_xlnm.Print_Titlesspecifies 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 # | |
Defined in Codec.Xlsx.Types | |
| Show DefinedNames # | |
Defined in Codec.Xlsx.Types Methods showsPrec :: Int -> DefinedNames -> ShowS # show :: DefinedNames -> String # showList :: [DefinedNames] -> ShowS # | |
| Generic DefinedNames # | |
Defined in Codec.Xlsx.Types Associated Types type Rep DefinedNames :: Type -> Type # | |
| Default DefinedNames # | |
Defined in Codec.Xlsx.Types Methods def :: DefinedNames # | |
| NFData DefinedNames # | |
Defined in Codec.Xlsx.Types Methods rnf :: DefinedNames -> () # | |
| type Rep DefinedNames # | |
Defined in Codec.Xlsx.Types | |
data ColumnsProperties #
Column range (from cwMin to cwMax) properties
Constructors
| ColumnsProperties | |
Fields
| |
Instances
Constructors
| PageSetup | |
Fields
| |
Instances
Xlsx worksheet
Constructors
| Worksheet | |
Fields
| |
Instances
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'
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
Constructors
| CellText Text | |
| CellDouble Double | |
| CellBool Bool | |
| CellRich [RichTextRun] | |
| CellError ErrorType |
Instances
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
data FormulaExpression #
formula type with type-specific options
Constructors
| NormalFormula Formula | |
| SharedFormula SharedFormulaIndex |
Instances
newtype SharedFormulaIndex #
index of shared formula in worksheet's wsSharedFormulas
property
Constructors
| SharedFormulaIndex Int |
data SharedFormulaOptions #
Constructors
| SharedFormulaOptions | |
Fields
| |
Currently cell details include cell values, style ids and cell
formulas (inline strings from <is> subelements are ignored)
Constructors
| Cell | |
Fields | |
Instances
| Eq Cell # | |
| Show Cell # | |
| Generic Cell # | |
| Default Cell # | |
Defined in Codec.Xlsx.Types.Cell | |
| NFData Cell # | |
Defined in Codec.Xlsx.Types.Cell | |
| type Rep Cell # | |
Defined in Codec.Xlsx.Types.Cell type Rep Cell = D1 (MetaData "Cell" "Codec.Xlsx.Types.Cell" "xlsx-0.7.2-JGGtT1sQysOJfkAOVHYL70" 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))))) | |
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 # | |
| Ord RowHeight # | |
| Read RowHeight # | |
| Show RowHeight # | |
| Generic RowHeight # | |
| NFData RowHeight # | |
Defined in Codec.Xlsx.Types | |
| type Rep RowHeight # | |
Defined in Codec.Xlsx.Types type Rep RowHeight = D1 (MetaData "RowHeight" "Codec.Xlsx.Types" "xlsx-0.7.2-JGGtT1sQysOJfkAOVHYL70" 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 | |
Instances
Lenses
Workbook
xlDateBase :: Lens' Xlsx DateBase #
Worksheet
Cells
cellFormula :: Lens' Cell (Maybe CellFormula) #
Style helpers
emptyStyles :: Styles #
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
simpleCellFormula :: Text -> CellFormula #
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
module Codec.Xlsx.Types.Variant
module Codec.Xlsx.Types.Table
module Codec.Xlsx.Types.StyleSheet
module Codec.Xlsx.Types.SheetViews
module Codec.Xlsx.Types.RichText
module Codec.Xlsx.Types.Protection
module Codec.Xlsx.Types.PivotTable
module Codec.Xlsx.Types.PageSetup
module Codec.Xlsx.Types.Drawing
module Codec.Xlsx.Types.Common
module Codec.Xlsx.Types.Comment
module Codec.Xlsx.Types.AutoFilter