xlsx 0.5.0 → 0.6.0
raw patch · 39 files changed
+569/−440 lines, 39 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Codec.Xlsx.Formatted: instance GHC.Generics.Generic Codec.Xlsx.Formatted.CondFormatted
+ Codec.Xlsx.Formatted: instance GHC.Generics.Generic Codec.Xlsx.Formatted.Format
+ Codec.Xlsx.Formatted: instance GHC.Generics.Generic Codec.Xlsx.Formatted.Formatted
+ Codec.Xlsx.Formatted: instance GHC.Generics.Generic Codec.Xlsx.Formatted.FormattedCell
+ Codec.Xlsx.Formatted: instance GHC.Generics.Generic Codec.Xlsx.Formatted.FormattedCondFmt
+ Codec.Xlsx.Lens: instance GHC.Generics.Generic Codec.Xlsx.Lens.SheetList
+ Codec.Xlsx.Parser: instance GHC.Generics.Generic Codec.Xlsx.Parser.ParseError
+ Codec.Xlsx.Parser: instance GHC.Generics.Generic Codec.Xlsx.Parser.WorksheetFile
+ Codec.Xlsx.Parser.Internal: instance GHC.Generics.Generic Codec.Xlsx.Parser.Internal.ParseException
+ Codec.Xlsx.Types: AutomaticHeight :: !Double -> RowHeight
+ Codec.Xlsx.Types: CustomHeight :: !Double -> RowHeight
+ Codec.Xlsx.Types: [rowHidden] :: RowProperties -> Bool
+ Codec.Xlsx.Types: data RowHeight
+ Codec.Xlsx.Types: instance Data.Default.Class.Default Codec.Xlsx.Types.RowProperties
+ Codec.Xlsx.Types: instance GHC.Classes.Eq Codec.Xlsx.Types.RowHeight
+ Codec.Xlsx.Types: instance GHC.Classes.Ord Codec.Xlsx.Types.RowHeight
+ Codec.Xlsx.Types: instance GHC.Generics.Generic Codec.Xlsx.Types.ColumnsProperties
+ Codec.Xlsx.Types: instance GHC.Generics.Generic Codec.Xlsx.Types.DefinedNames
+ Codec.Xlsx.Types: instance GHC.Generics.Generic Codec.Xlsx.Types.RowHeight
+ Codec.Xlsx.Types: instance GHC.Generics.Generic Codec.Xlsx.Types.RowProperties
+ Codec.Xlsx.Types: instance GHC.Generics.Generic Codec.Xlsx.Types.Styles
+ Codec.Xlsx.Types: instance GHC.Generics.Generic Codec.Xlsx.Types.Worksheet
+ Codec.Xlsx.Types: instance GHC.Generics.Generic Codec.Xlsx.Types.Xlsx
+ Codec.Xlsx.Types: instance GHC.Read.Read Codec.Xlsx.Types.RowHeight
+ Codec.Xlsx.Types: instance GHC.Show.Show Codec.Xlsx.Types.RowHeight
+ Codec.Xlsx.Types.AutoFilter: instance GHC.Generics.Generic Codec.Xlsx.Types.AutoFilter.AutoFilter
+ Codec.Xlsx.Types.AutoFilter: instance GHC.Generics.Generic Codec.Xlsx.Types.AutoFilter.CustomFilter
+ Codec.Xlsx.Types.AutoFilter: instance GHC.Generics.Generic Codec.Xlsx.Types.AutoFilter.CustomFilterOperator
+ Codec.Xlsx.Types.AutoFilter: instance GHC.Generics.Generic Codec.Xlsx.Types.AutoFilter.FilterColumn
+ Codec.Xlsx.Types.Cell: instance GHC.Generics.Generic Codec.Xlsx.Types.Cell.Cell
+ Codec.Xlsx.Types.Cell: instance GHC.Generics.Generic Codec.Xlsx.Types.Cell.CellFormula
+ Codec.Xlsx.Types.Comment: instance GHC.Generics.Generic Codec.Xlsx.Types.Comment.Comment
+ Codec.Xlsx.Types.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Common.CellRef
+ Codec.Xlsx.Types.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Common.CellValue
+ Codec.Xlsx.Types.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Common.Formula
+ Codec.Xlsx.Types.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Common.SqRef
+ Codec.Xlsx.Types.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Common.XlsxText
+ Codec.Xlsx.Types.ConditionalFormatting: instance GHC.Generics.Generic Codec.Xlsx.Types.ConditionalFormatting.CfRule
+ Codec.Xlsx.Types.ConditionalFormatting: instance GHC.Generics.Generic Codec.Xlsx.Types.ConditionalFormatting.Condition
+ Codec.Xlsx.Types.ConditionalFormatting: instance GHC.Generics.Generic Codec.Xlsx.Types.ConditionalFormatting.OperatorExpression
+ Codec.Xlsx.Types.ConditionalFormatting: instance GHC.Generics.Generic Codec.Xlsx.Types.ConditionalFormatting.TimePeriod
+ Codec.Xlsx.Types.DataValidation: instance GHC.Generics.Generic Codec.Xlsx.Types.DataValidation.DataValidation
+ Codec.Xlsx.Types.DataValidation: instance GHC.Generics.Generic Codec.Xlsx.Types.DataValidation.ErrorStyle
+ Codec.Xlsx.Types.DataValidation: instance GHC.Generics.Generic Codec.Xlsx.Types.DataValidation.ValidationExpression
+ Codec.Xlsx.Types.DataValidation: instance GHC.Generics.Generic Codec.Xlsx.Types.DataValidation.ValidationType
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic (Codec.Xlsx.Types.Drawing.Anchor p g)
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic (Codec.Xlsx.Types.Drawing.BlipFillProperties a)
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic (Codec.Xlsx.Types.Drawing.DrawingObject p g)
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic (Codec.Xlsx.Types.Drawing.GenericDrawing p g)
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Anchoring
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.ClientData
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.DrawingElementId
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.EditAs
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.FileInfo
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.FillMode
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.GraphNonVisual
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Marker
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.NonVisualDrawingProperties
+ Codec.Xlsx.Types.Drawing: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.PicNonVisual
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.AreaSeries
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.BarDirection
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.BarSeries
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.Chart
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.ChartGrouping
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.ChartSpace
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.ChartTitle
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.DataLblProps
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.DataMarker
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.DataMarkerSymbol
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.DataPoint
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.DispBlanksAs
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.Legend
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.LegendPos
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.LineSeries
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.PieSeries
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.ScatterSeries
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.ScatterStyle
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.Series
+ Codec.Xlsx.Types.Drawing.Chart: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Chart.TickMark
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.Angle
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.ColorChoice
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.Coordinate
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.FillProperties
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.Geometry
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.LineProperties
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.Point2D
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.PositiveCoordinate
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.PositiveSize2D
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.ShapeProperties
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextAnchoring
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextBody
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextCharacterProperties
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextParagraph
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextRun
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextVertOverflow
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextVertical
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.TextWrap
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.Transform2D
+ Codec.Xlsx.Types.Drawing.Common: instance GHC.Generics.Generic Codec.Xlsx.Types.Drawing.Common.UnitIdentifier
+ Codec.Xlsx.Types.Internal: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.RefId
+ Codec.Xlsx.Types.Internal.CfPair: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.CfPair.CfPair
+ Codec.Xlsx.Types.Internal.CommentTable: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.CommentTable.CommentTable
+ Codec.Xlsx.Types.Internal.ContentTypes: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.ContentTypes.ContentTypes
+ Codec.Xlsx.Types.Internal.ContentTypes: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.ContentTypes.CtDefault
+ Codec.Xlsx.Types.Internal.ContentTypes: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.ContentTypes.Override
+ Codec.Xlsx.Types.Internal.CustomProperties: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.CustomProperties.CustomProperties
+ Codec.Xlsx.Types.Internal.DvPair: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.DvPair.DvPair
+ Codec.Xlsx.Types.Internal.NumFmtPair: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.NumFmtPair.NumFmtPair
+ Codec.Xlsx.Types.Internal.Relationships: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.Relationships.Relationship
+ Codec.Xlsx.Types.Internal.Relationships: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.Relationships.Relationships
+ Codec.Xlsx.Types.Internal.SharedStringTable: instance GHC.Generics.Generic Codec.Xlsx.Types.Internal.SharedStringTable.SharedStringTable
+ Codec.Xlsx.Types.PageSetup: instance GHC.Generics.Generic Codec.Xlsx.Types.PageSetup.CellComments
+ Codec.Xlsx.Types.PageSetup: instance GHC.Generics.Generic Codec.Xlsx.Types.PageSetup.Orientation
+ Codec.Xlsx.Types.PageSetup: instance GHC.Generics.Generic Codec.Xlsx.Types.PageSetup.PageOrder
+ Codec.Xlsx.Types.PageSetup: instance GHC.Generics.Generic Codec.Xlsx.Types.PageSetup.PageSetup
+ Codec.Xlsx.Types.PageSetup: instance GHC.Generics.Generic Codec.Xlsx.Types.PageSetup.PaperSize
+ Codec.Xlsx.Types.PageSetup: instance GHC.Generics.Generic Codec.Xlsx.Types.PageSetup.PrintErrors
+ Codec.Xlsx.Types.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.ConsolidateFunction
+ Codec.Xlsx.Types.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.DataField
+ Codec.Xlsx.Types.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.FieldSortType
+ Codec.Xlsx.Types.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.PivotFieldInfo
+ Codec.Xlsx.Types.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.PivotFieldName
+ Codec.Xlsx.Types.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.PivotTable
+ Codec.Xlsx.Types.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.PositionedField
+ Codec.Xlsx.Types.PivotTable.Internal: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.Internal.CacheField
+ Codec.Xlsx.Types.PivotTable.Internal: instance GHC.Generics.Generic Codec.Xlsx.Types.PivotTable.Internal.CacheId
+ Codec.Xlsx.Types.Protection: instance GHC.Generics.Generic Codec.Xlsx.Types.Protection.LegacyPassword
+ Codec.Xlsx.Types.Protection: instance GHC.Generics.Generic Codec.Xlsx.Types.Protection.SheetProtection
+ Codec.Xlsx.Types.RichText: instance GHC.Generics.Generic Codec.Xlsx.Types.RichText.RichTextRun
+ Codec.Xlsx.Types.RichText: instance GHC.Generics.Generic Codec.Xlsx.Types.RichText.RunProperties
+ Codec.Xlsx.Types.SheetViews: instance GHC.Generics.Generic Codec.Xlsx.Types.SheetViews.Pane
+ Codec.Xlsx.Types.SheetViews: instance GHC.Generics.Generic Codec.Xlsx.Types.SheetViews.PaneState
+ Codec.Xlsx.Types.SheetViews: instance GHC.Generics.Generic Codec.Xlsx.Types.SheetViews.PaneType
+ Codec.Xlsx.Types.SheetViews: instance GHC.Generics.Generic Codec.Xlsx.Types.SheetViews.Selection
+ Codec.Xlsx.Types.SheetViews: instance GHC.Generics.Generic Codec.Xlsx.Types.SheetViews.SheetView
+ Codec.Xlsx.Types.SheetViews: instance GHC.Generics.Generic Codec.Xlsx.Types.SheetViews.SheetViewType
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.Alignment
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.Border
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.BorderStyle
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.CellHorizontalAlignment
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.CellVerticalAlignment
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.CellXf
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.Color
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.Dxf
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.Fill
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.FillPattern
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.Font
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.FontFamily
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.FontScheme
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.FontUnderline
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.FontVerticalAlignment
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.ImpliedNumberFormat
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.LineStyle
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.NumberFormat
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.PatternType
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.Protection
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.ReadingOrder
+ Codec.Xlsx.Types.StyleSheet: instance GHC.Generics.Generic Codec.Xlsx.Types.StyleSheet.StyleSheet
+ Codec.Xlsx.Types.Table: instance GHC.Generics.Generic Codec.Xlsx.Types.Table.Table
+ Codec.Xlsx.Types.Table: instance GHC.Generics.Generic Codec.Xlsx.Types.Table.TableColumn
+ Codec.Xlsx.Types.Variant: instance GHC.Generics.Generic Codec.Xlsx.Types.Variant.Variant
+ Codec.Xlsx.Writer: instance GHC.Generics.Generic Codec.Xlsx.Writer.XlsxCell
+ Codec.Xlsx.Writer: instance GHC.Generics.Generic Codec.Xlsx.Writer.XlsxCellData
+ Codec.Xlsx.Writer.Internal.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Writer.Internal.PivotTable.CacheDefinition
+ Codec.Xlsx.Writer.Internal.PivotTable: instance GHC.Generics.Generic Codec.Xlsx.Writer.Internal.PivotTable.PivotTableFiles
- Codec.Xlsx.Types: RowProps :: Maybe Double -> Maybe Int -> RowProperties
+ Codec.Xlsx.Types: RowProps :: Maybe RowHeight -> Maybe Int -> Bool -> RowProperties
- Codec.Xlsx.Types: [rowHeight] :: RowProperties -> Maybe Double
+ Codec.Xlsx.Types: [rowHeight] :: RowProperties -> Maybe RowHeight
- Codec.Xlsx.Types.Drawing: anchAnchoring :: forall p_a2qs6 g_a2qs7. Lens' (Anchor p_a2qs6 g_a2qs7) Anchoring
+ Codec.Xlsx.Types.Drawing: anchAnchoring :: forall p_a2Lz5 g_a2Lz6. Lens' (Anchor p_a2Lz5 g_a2Lz6) Anchoring
- Codec.Xlsx.Types.Drawing: anchClientData :: forall p_a2qs6 g_a2qs7. Lens' (Anchor p_a2qs6 g_a2qs7) ClientData
+ Codec.Xlsx.Types.Drawing: anchClientData :: forall p_a2Lz5 g_a2Lz6. Lens' (Anchor p_a2Lz5 g_a2Lz6) ClientData
- Codec.Xlsx.Types.Drawing: anchObject :: forall p_a2qs6 g_a2qs7 p_a2rrr g_a2rrs. Lens (Anchor p_a2qs6 g_a2qs7) (Anchor p_a2rrr g_a2rrs) (DrawingObject p_a2qs6 g_a2qs7) (DrawingObject p_a2rrr g_a2rrs)
+ Codec.Xlsx.Types.Drawing: anchObject :: forall p_a2Lz5 g_a2Lz6 p_a2MYR g_a2MYS. Lens (Anchor p_a2Lz5 g_a2Lz6) (Anchor p_a2MYR g_a2MYS) (DrawingObject p_a2Lz5 g_a2Lz6) (DrawingObject p_a2MYR g_a2MYS)
- Codec.Xlsx.Types.Drawing: bfpFillMode :: forall a_a2qs8. Lens' (BlipFillProperties a_a2qs8) (Maybe FillMode)
+ Codec.Xlsx.Types.Drawing: bfpFillMode :: forall a_a2Lz7. Lens' (BlipFillProperties a_a2Lz7) (Maybe FillMode)
- Codec.Xlsx.Types.Drawing: bfpImageInfo :: forall a_a2qs8 a_a2rzq. Lens (BlipFillProperties a_a2qs8) (BlipFillProperties a_a2rzq) (Maybe a_a2qs8) (Maybe a_a2rzq)
+ Codec.Xlsx.Types.Drawing: bfpImageInfo :: forall a_a2Lz7 a_a2N6Q. Lens (BlipFillProperties a_a2Lz7) (BlipFillProperties a_a2N6Q) (Maybe a_a2Lz7) (Maybe a_a2N6Q)
- Codec.Xlsx.Types.Drawing: grChartSpace :: forall p_a2qs9 g_a2qsa g_a2rtj. Traversal (DrawingObject p_a2qs9 g_a2qsa) (DrawingObject p_a2qs9 g_a2rtj) g_a2qsa g_a2rtj
+ Codec.Xlsx.Types.Drawing: grChartSpace :: forall p_a2Lz8 g_a2Lz9 g_a2N0J. Traversal (DrawingObject p_a2Lz8 g_a2Lz9) (DrawingObject p_a2Lz8 g_a2N0J) g_a2Lz9 g_a2N0J
- Codec.Xlsx.Types.Drawing: grNonVisual :: forall p_a2qs9 g_a2qsa. Traversal' (DrawingObject p_a2qs9 g_a2qsa) GraphNonVisual
+ Codec.Xlsx.Types.Drawing: grNonVisual :: forall p_a2Lz8 g_a2Lz9. Traversal' (DrawingObject p_a2Lz8 g_a2Lz9) GraphNonVisual
- Codec.Xlsx.Types.Drawing: grTransform :: forall p_a2qs9 g_a2qsa. Traversal' (DrawingObject p_a2qs9 g_a2qsa) Transform2D
+ Codec.Xlsx.Types.Drawing: grTransform :: forall p_a2Lz8 g_a2Lz9. Traversal' (DrawingObject p_a2Lz8 g_a2Lz9) Transform2D
- Codec.Xlsx.Types.Drawing: picBlipFill :: forall p_a2qs9 g_a2qsa p_a2rtk. Traversal (DrawingObject p_a2qs9 g_a2qsa) (DrawingObject p_a2rtk g_a2qsa) (BlipFillProperties p_a2qs9) (BlipFillProperties p_a2rtk)
+ Codec.Xlsx.Types.Drawing: picBlipFill :: forall p_a2Lz8 g_a2Lz9 p_a2N0K. Traversal (DrawingObject p_a2Lz8 g_a2Lz9) (DrawingObject p_a2N0K g_a2Lz9) (BlipFillProperties p_a2Lz8) (BlipFillProperties p_a2N0K)
- Codec.Xlsx.Types.Drawing: picMacro :: forall p_a2qs9 g_a2qsa. Traversal' (DrawingObject p_a2qs9 g_a2qsa) (Maybe Text)
+ Codec.Xlsx.Types.Drawing: picMacro :: forall p_a2Lz8 g_a2Lz9. Traversal' (DrawingObject p_a2Lz8 g_a2Lz9) (Maybe Text)
- Codec.Xlsx.Types.Drawing: picNonVisual :: forall p_a2qs9 g_a2qsa. Traversal' (DrawingObject p_a2qs9 g_a2qsa) PicNonVisual
+ Codec.Xlsx.Types.Drawing: picNonVisual :: forall p_a2Lz8 g_a2Lz9. Traversal' (DrawingObject p_a2Lz8 g_a2Lz9) PicNonVisual
- Codec.Xlsx.Types.Drawing: picPublished :: forall p_a2qs9 g_a2qsa. Traversal' (DrawingObject p_a2qs9 g_a2qsa) Bool
+ Codec.Xlsx.Types.Drawing: picPublished :: forall p_a2Lz8 g_a2Lz9. Traversal' (DrawingObject p_a2Lz8 g_a2Lz9) Bool
- Codec.Xlsx.Types.Drawing: picShapeProperties :: forall p_a2qs9 g_a2qsa. Traversal' (DrawingObject p_a2qs9 g_a2qsa) ShapeProperties
+ Codec.Xlsx.Types.Drawing: picShapeProperties :: forall p_a2Lz8 g_a2Lz9. Traversal' (DrawingObject p_a2Lz8 g_a2Lz9) ShapeProperties
- Codec.Xlsx.Types.Drawing: xdrAnchors :: forall p_a2qs4 g_a2qs5 p_a2rAu g_a2rAv. Iso (GenericDrawing p_a2qs4 g_a2qs5) (GenericDrawing p_a2rAu g_a2rAv) [Anchor p_a2qs4 g_a2qs5] [Anchor p_a2rAu g_a2rAv]
+ Codec.Xlsx.Types.Drawing: xdrAnchors :: forall p_a2Lz3 g_a2Lz4 p_a2N7U g_a2N7V. Iso (GenericDrawing p_a2Lz3 g_a2Lz4) (GenericDrawing p_a2N7U g_a2N7V) [Anchor p_a2Lz3 g_a2Lz4] [Anchor p_a2N7U g_a2N7V]
- Codec.Xlsx.Types.Table: Table :: Text -> Text -> CellRef -> [TableColumn] -> Maybe AutoFilter -> Table
+ Codec.Xlsx.Types.Table: Table :: Text -> Maybe Text -> CellRef -> [TableColumn] -> Maybe AutoFilter -> Table
- Codec.Xlsx.Types.Table: [tblName] :: Table -> Text
+ Codec.Xlsx.Types.Table: [tblName] :: Table -> Maybe Text
Files
- CHANGELOG.markdown +12/−0
- src/Codec/Xlsx/Formatted.hs +25/−23
- src/Codec/Xlsx/Lens.hs +22/−20
- src/Codec/Xlsx/Parser.hs +21/−11
- src/Codec/Xlsx/Parser/Internal.hs +12/−10
- src/Codec/Xlsx/Parser/Internal/PivotTable.hs +1/−0
- src/Codec/Xlsx/Types.hs +62/−39
- src/Codec/Xlsx/Types/AutoFilter.hs +7/−4
- src/Codec/Xlsx/Types/Cell.hs +4/−2
- src/Codec/Xlsx/Types/Comment.hs +5/−3
- src/Codec/Xlsx/Types/Common.hs +8/−5
- src/Codec/Xlsx/Types/ConditionalFormatting.hs +27/−25
- src/Codec/Xlsx/Types/DataValidation.hs +20/−18
- src/Codec/Xlsx/Types/Drawing.hs +17/−15
- src/Codec/Xlsx/Types/Drawing/Chart.hs +23/−20
- src/Codec/Xlsx/Types/Drawing/Common.hs +23/−20
- src/Codec/Xlsx/Types/Internal.hs +8/−6
- src/Codec/Xlsx/Types/Internal/CfPair.hs +8/−7
- src/Codec/Xlsx/Types/Internal/CommentTable.hs +3/−1
- src/Codec/Xlsx/Types/Internal/ContentTypes.hs +16/−14
- src/Codec/Xlsx/Types/Internal/CustomProperties.hs +11/−9
- src/Codec/Xlsx/Types/Internal/DvPair.hs +9/−8
- src/Codec/Xlsx/Types/Internal/NumFmtPair.hs +6/−4
- src/Codec/Xlsx/Types/Internal/Relationships.hs +19/−17
- src/Codec/Xlsx/Types/Internal/SharedStringTable.hs +17/−16
- src/Codec/Xlsx/Types/PageSetup.hs +9/−7
- src/Codec/Xlsx/Types/PivotTable.hs +9/−7
- src/Codec/Xlsx/Types/PivotTable/Internal.hs +5/−2
- src/Codec/Xlsx/Types/Protection.hs +5/−2
- src/Codec/Xlsx/Types/RichText.hs +5/−2
- src/Codec/Xlsx/Types/SheetViews.hs +9/−6
- src/Codec/Xlsx/Types/StyleSheet.hs +38/−38
- src/Codec/Xlsx/Types/Table.hs +11/−7
- src/Codec/Xlsx/Types/Variant.hs +12/−10
- src/Codec/Xlsx/Writer.hs +59/−47
- src/Codec/Xlsx/Writer/Internal.hs +10/−9
- src/Codec/Xlsx/Writer/Internal/PivotTable.hs +5/−3
- test/Main.hs +5/−2
- xlsx.cabal +1/−1
CHANGELOG.markdown view
@@ -1,3 +1,15 @@+0.6.0+-----+* fixed reading files with optional table name (thanks Aleksey Khudyakov+ <alexey.skladnoy@gmail.com> for reporting)+* removed unnecessary 10cm offset from `simpleAnchorXY`+* `customRowHeight` added to row properties (thanks Aleksey Khudyakov+ <alexey.skladnoy@gmail.com>)+* added `Generic` instances for library types (thanks Remy Goldschmidt+ <taktoa@gmail.com>)+* `hidden` property added for rows (thanks Aleksey Khudyakov+ <alexey.skladnoy@gmail.com>)+ 0.5.0 ----- * renamed `ColumnsWidth` to more intuitive `ColumnsProperties` and
src/Codec/Xlsx/Formatted.hs view
@@ -3,8 +3,9 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}-module Codec.Xlsx.Formatted (- FormattedCell(..)+{-# LANGUAGE DeriveGeneric #-}+module Codec.Xlsx.Formatted+ ( FormattedCell(..) , Formatted(..) , formatted , toFormattedCells@@ -32,26 +33,27 @@ , condfmtStopIfTrue ) where -import Control.Lens-import Control.Monad.State hiding (forM_, mapM)-import Data.Default-import Data.Foldable (asum, forM_)-import Data.Function (on)-import Data.List (foldl', groupBy, sortBy, sortBy)-import Data.Map (Map)-import qualified Data.Map as M-import Data.Ord (comparing)-import Data.Text (Text)-import Data.Traversable (mapM)-import Data.Tuple (swap)-import Prelude hiding (mapM)-import Safe (headNote, fromJustNote)+import Control.Lens+import Control.Monad.State hiding (forM_, mapM)+import Data.Default+import Data.Foldable (asum, forM_)+import Data.Function (on)+import Data.List (foldl', groupBy, sortBy, sortBy)+import Data.Map (Map)+import qualified Data.Map as M+import Data.Ord (comparing)+import Data.Text (Text)+import Data.Traversable (mapM)+import Data.Tuple (swap)+import GHC.Generics (Generic)+import Prelude hiding (mapM)+import Safe (headNote, fromJustNote) #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif -import Codec.Xlsx.Types+import Codec.Xlsx.Types {------------------------------------------------------------------------------- Internal: formatting state@@ -118,7 +120,7 @@ , _condfmtDxf :: Dxf , _condfmtPriority :: Int , _condfmtStopIfTrue :: Maybe Bool- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''FormattedCondFmt @@ -141,7 +143,7 @@ , _formatProtection :: Maybe Protection , _formatPivotButton :: Maybe Bool , _formatQuotePrefix :: Maybe Bool- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''Format @@ -153,7 +155,7 @@ , _formattedFormat :: Format , _formattedColSpan :: Int , _formattedRowSpan :: Int- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''FormattedCell @@ -200,7 +202,7 @@ -- | The final list of cell merges; see '_wsMerges' , formattedMerges :: [Range]- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Higher level API for creating formatted documents --@@ -289,7 +291,7 @@ condformattedStyleSheet :: StyleSheet -- | The final map of conditional formatting rules applied to ranges , condformattedFormattings :: Map SqRef ConditionalFormatting- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) conditionallyFormatted :: Map CellRef [FormattedCondFmt] -> StyleSheet -> CondFormatted conditionallyFormatted cfs styleSheet = CondFormatted
src/Codec/Xlsx/Lens.hs view
@@ -1,36 +1,38 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE DeriveGeneric #-} -- | lenses to access sheets, cells and values of 'Xlsx' module Codec.Xlsx.Lens- ( ixSheet- , atSheet- , ixCell- , ixCellRC- , ixCellXY- , atCell- , atCellRC- , atCellXY- , cellValueAt- , cellValueAtRC- , cellValueAtXY- ) where+ ( ixSheet+ , atSheet+ , ixCell+ , ixCellRC+ , ixCellXY+ , atCell+ , atCellRC+ , atCellXY+ , cellValueAt+ , cellValueAtRC+ , cellValueAtXY+ ) where -import Codec.Xlsx.Types-import Control.Lens-import Data.Function (on)-import Data.List (deleteBy)-import Data.Text-import Data.Tuple (swap)+import Codec.Xlsx.Types+import Control.Lens+import Data.Function (on)+import Data.List (deleteBy)+import Data.Text+import Data.Tuple (swap)+import GHC.Generics (Generic) #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif newtype SheetList = SheetList{ unSheetList :: [(Text, Worksheet)] }- deriving (Eq, Show)+ deriving (Eq, Show, Generic) type instance IxValue (SheetList) = Worksheet type instance Index (SheetList) = Text
src/Codec/Xlsx/Parser.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE DeriveGeneric #-} -- | This module provides a function for reading .xlsx files module Codec.Xlsx.Parser@@ -12,6 +13,7 @@ , Parser ) where + import qualified Codec.Archive.Zip as Zip import Control.Applicative import Control.Arrow (left)@@ -29,6 +31,7 @@ import qualified Data.Text as T import qualified Data.Text.Read as T import Data.Traversable+import GHC.Generics (Generic) import Prelude hiding (sequence) import System.FilePath.Posix import Text.XML as X@@ -57,7 +60,7 @@ | InvalidFile FilePath | InvalidRef FilePath RefId | InconsistentXlsx Text- deriving (Show, Eq)+ deriving (Eq, Show, Generic) type Parser = Either ParseError @@ -77,7 +80,7 @@ data WorksheetFile = WorksheetFile { wfName :: Text , wfPath :: FilePath }- deriving Show+ deriving (Show, Generic) type Caches = [(CacheId, (Text, CellRef, [CacheField]))] @@ -117,15 +120,22 @@ (rowProps, cells0) = collect $ cur $/ element (n_ "sheetData") &/ element (n_ "row") >=> parseRow parseRow :: Cursor -> [(Int, Maybe RowProperties, [(Int, Int, Cell)])] parseRow c = do- r <- c $| attribute "r" >=> decimal- let ht = if attribute "customHeight" c == ["true"]- then listToMaybe $ c $| attribute "ht" >=> rational- else Nothing- let s = listToMaybe $ decimal =<< attribute "s" c :: Maybe Int- let rp = if isNothing s && isNothing ht- then Nothing- else Just (RowProps ht s)- return (r, rp, c $/ element (n_ "c") >=> parseCell)+ r <- fromAttribute "r" c+ let prop = RowProps+ { rowHeight = do h <- listToMaybe $ fromAttribute "ht" c+ case fromAttribute "customHeight" c of+ [True] -> return $ CustomHeight h+ _ -> return $ AutomaticHeight h+ , rowStyle = listToMaybe $ fromAttribute "s" c+ , rowHidden =+ case fromAttribute "hidden" c of+ [] -> False+ f:_ -> f+ }+ return ( r+ , if prop == def then Nothing else Just prop+ , c $/ element (n_ "c") >=> parseCell+ ) parseCell :: Cursor -> [(Int, Int, Cell)] parseCell cell = do ref <- fromAttribute "r" cell
src/Codec/Xlsx/Parser/Internal.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Parser.Internal ( ParseException(..) , n_@@ -27,21 +28,22 @@ , rational ) where -import Control.Exception (Exception)-import Data.Maybe-import Data.Text (Text)-import qualified Data.Text as T-import qualified Data.Text.Read as T-import Data.Typeable (Typeable)-import Text.XML-import Text.XML.Cursor+import Control.Exception (Exception)+import Data.Maybe+import Data.Text (Text)+import qualified Data.Text as T+import qualified Data.Text.Read as T+import Data.Typeable (Typeable)+import GHC.Generics (Generic)+import Text.XML+import Text.XML.Cursor #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif data ParseException = ParseException String- deriving (Show, Typeable)+ deriving (Show, Typeable, Generic) instance Exception ParseException
src/Codec/Xlsx/Parser/Internal/PivotTable.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Parser.Internal.PivotTable ( parsePivotTable , parseCache
src/Codec/Xlsx/Types.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types ( -- * The main types Xlsx(..)@@ -14,6 +15,7 @@ , CellValue(..) , CellFormula(..) , Cell(..)+ , RowHeight(..) , RowProperties (..) -- * Lenses -- ** Workbook@@ -52,43 +54,64 @@ , module X ) where -import Control.Exception (SomeException,- toException)-import Control.Lens.TH-import qualified Data.ByteString.Lazy as L-import Data.Default-import Data.Function (on)-import Data.List (groupBy)-import Data.Map (Map)-import qualified Data.Map as M-import Data.Maybe (catMaybes, isJust)-import Data.Text (Text)-import Text.XML (parseLBS, renderLBS)-import Text.XML.Cursor+import Control.Exception (SomeException, toException)+import Control.Lens.TH+import qualified Data.ByteString.Lazy as L+import Data.Default+import Data.Function (on)+import Data.List (groupBy)+import Data.Map (Map)+import qualified Data.Map as M+import Data.Maybe (catMaybes, isJust)+import Data.Text (Text)+import GHC.Generics (Generic)+import Text.XML (parseLBS, renderLBS)+import Text.XML.Cursor -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.AutoFilter as X-import Codec.Xlsx.Types.Cell as Cell-import Codec.Xlsx.Types.Comment as X-import Codec.Xlsx.Types.Common as X-import Codec.Xlsx.Types.ConditionalFormatting as X-import Codec.Xlsx.Types.DataValidation as X-import Codec.Xlsx.Types.Drawing as X-import Codec.Xlsx.Types.Drawing.Chart as X-import Codec.Xlsx.Types.Drawing.Common as X-import Codec.Xlsx.Types.PageSetup as X-import Codec.Xlsx.Types.PivotTable as X-import Codec.Xlsx.Types.Protection as X-import Codec.Xlsx.Types.RichText as X-import Codec.Xlsx.Types.SheetViews as X-import Codec.Xlsx.Types.StyleSheet as X-import Codec.Xlsx.Types.Table as X-import Codec.Xlsx.Types.Variant as X-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.AutoFilter as X+import Codec.Xlsx.Types.Cell as Cell+import Codec.Xlsx.Types.Comment as X+import Codec.Xlsx.Types.Common as X+import Codec.Xlsx.Types.ConditionalFormatting as X+import Codec.Xlsx.Types.DataValidation as X+import Codec.Xlsx.Types.Drawing as X+import Codec.Xlsx.Types.Drawing.Chart as X+import Codec.Xlsx.Types.Drawing.Common as X+import Codec.Xlsx.Types.PageSetup as X+import Codec.Xlsx.Types.PivotTable as X+import Codec.Xlsx.Types.Protection as X+import Codec.Xlsx.Types.RichText as X+import Codec.Xlsx.Types.SheetViews as X+import Codec.Xlsx.Types.StyleSheet as X+import Codec.Xlsx.Types.Table as X+import Codec.Xlsx.Types.Variant as X+import Codec.Xlsx.Writer.Internal -data RowProperties = RowProps { rowHeight :: Maybe Double, rowStyle::Maybe Int}- deriving (Read,Eq,Show,Ord)+-- | Height of a row in points (1/72in)+data RowHeight+ = CustomHeight !Double+ -- ^ Row height is set by the user+ | AutomaticHeight !Double+ -- ^ Row height is set automatically by the program+ deriving (Eq, Ord, Show, Read, Generic) +-- | Properties of a row. See §18.3.1.73 "row (Row)" for more details+data RowProperties = RowProps+ { rowHeight :: Maybe RowHeight+ -- ^ Row height in points+ , rowStyle :: Maybe Int+ -- ^ Style to be applied to row+ , rowHidden :: Bool+ -- ^ Whether row is visible or not+ } deriving (Eq, Ord, Show, Read, Generic)++instance Default RowProperties where+ def = RowProps { rowHeight = Nothing+ , rowStyle = Nothing+ , rowHidden = False+ }+ -- | Column range (from cwMin to cwMax) properties data ColumnsProperties = ColumnsProperties { cpMin :: Int@@ -115,7 +138,7 @@ , cpBestFit :: Bool -- ^ Flag indicating if the specified column(s) is set to 'best -- fit'.- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) instance FromCursor ColumnsProperties where fromCursor c = do@@ -143,7 +166,7 @@ , _wsAutoFilter :: Maybe AutoFilter , _wsTables :: [Table] , _wsProtection :: Maybe SheetProtection- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''Worksheet @@ -166,7 +189,7 @@ } newtype Styles = Styles {unStyles :: L.ByteString}- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Structured representation of Xlsx file (currently a subset of its contents) data Xlsx = Xlsx@@ -174,7 +197,7 @@ , _xlStyles :: Styles , _xlDefinedNames :: DefinedNames , _xlCustomProperties :: Map Text Variant- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Defined names --@@ -198,7 +221,7 @@ -- -- NOTE: Right now this is only a minimal implementation of defined names. newtype DefinedNames = DefinedNames [(Text, Maybe Text, Text)]- deriving (Eq, Show)+ deriving (Eq, Show, Generic) makeLenses ''Xlsx
src/Codec/Xlsx/Types/AutoFilter.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.AutoFilter where +import GHC.Generics (Generic)+ import Control.Lens (makeLenses) import Data.Default import Data.Map (Map)@@ -30,12 +33,12 @@ CustomFilter | CustomFiltersAnd CustomFilter CustomFilter- deriving (Eq, Show)+ deriving (Eq, Show, Generic) data CustomFilter = CustomFilter { cfltOperator :: CustomFilterOperator , cfltValue :: Text- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data CustomFilterOperator = FltrEqual@@ -50,7 +53,7 @@ -- ^ Show results which are less than or equal to criteria. | FltrNotEqual -- ^ Show results which are not equal to criteria.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | AutoFilter temporarily hides rows based on a filter criteria, -- which is applied column by column to a table of datain the@@ -62,7 +65,7 @@ data AutoFilter = AutoFilter { _afRef :: Maybe CellRef , _afFilterColumns :: Map Int FilterColumn- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''AutoFilter
src/Codec/Xlsx/Types/Cell.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Cell ( CellFormula(..) , simpleCellFormula@@ -18,6 +19,7 @@ import qualified Data.Map as M import Data.Maybe (catMaybes) import Data.Text (Text)+import GHC.Generics (Generic) import Text.XML import Text.XML.Cursor @@ -41,7 +43,7 @@ -- the next time calculation is performed. -- [/Example/: This is always set on volatile functions, -- like =RAND(), and circular references. /end example/]- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) simpleCellFormula :: Text -> CellFormula simpleCellFormula expr = NormalCellFormula@@ -57,7 +59,7 @@ , _cellValue :: Maybe CellValue , _cellComment :: Maybe Comment , _cellFormula :: Maybe CellFormula- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) instance Default Cell where def = Cell Nothing Nothing Nothing Nothing
src/Codec/Xlsx/Types/Comment.hs view
@@ -1,8 +1,10 @@+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Comment where -import Data.Text (Text)+import Data.Text (Text)+import GHC.Generics (Generic) -import Codec.Xlsx.Types.Common+import Codec.Xlsx.Types.Common -- | User comment for a cell --@@ -17,4 +19,4 @@ , _commentAuthor :: Text -- ^ comment author , _commentVisible :: Bool- } deriving (Show, Eq)+ } deriving (Eq, Show, Generic)
src/Codec/Xlsx/Types/Common.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Common ( CellRef(..) , singleCellRef@@ -16,6 +17,8 @@ , col2int ) where +import GHC.Generics (Generic)+ import Control.Arrow import Control.Monad (guard) import Data.Char@@ -56,7 +59,7 @@ -- See 18.18.62 @ST_Ref@ (p. 2482) newtype CellRef = CellRef { unCellRef :: Text- } deriving (Eq, Ord, Show)+ } deriving (Eq, Ord, Show, Generic) -- | Render position in @(row, col)@ format to an Excel reference. --@@ -107,7 +110,7 @@ -- -- See 18.18.76 "ST_Sqref (Reference Sequence)" (p.2488) newtype SqRef = SqRef [CellRef]- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) -- | Common type containing either simple string or rich formatted text. -- Used in @si@, @comment@ and @is@ elements@@ -129,13 +132,13 @@ -- See @CT_Rst@, p. 3903 data XlsxText = XlsxText Text | XlsxRichText [RichTextRun]- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | A formula -- -- See 18.18.35 "ST_Formula (Formula)" (p. 2457) newtype Formula = Formula {unFormula :: Text}- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) -- | Cell values include text, numbers and booleans, -- standard includes date format also but actually dates@@ -146,7 +149,7 @@ | CellDouble Double | CellBool Bool | CellRich [RichTextRun]- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Parsing
src/Codec/Xlsx/Types/ConditionalFormatting.hs view
@@ -1,33 +1,35 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.ConditionalFormatting- ( ConditionalFormatting- , CfRule(..)- , Condition(..)- , OperatorExpression (..)- , TimePeriod (..)+ ( ConditionalFormatting+ , CfRule(..)+ , Condition(..)+ , OperatorExpression(..)+ , TimePeriod(..) -- * Lenses -- ** CfRule- , cfrCondition- , cfrDxfId- , cfrPriority- , cfrStopIfTrue+ , cfrCondition+ , cfrDxfId+ , cfrPriority+ , cfrStopIfTrue -- * Misc- , topCfPriority- ) where+ , topCfPriority+ ) where -import Control.Lens (makeLenses)-import Data.Map (Map)-import qualified Data.Map as M-import Data.Maybe-import Data.Text (Text)-import Text.XML-import Text.XML.Cursor+import Control.Lens (makeLenses)+import Data.Map (Map)+import qualified Data.Map as M+import Data.Maybe+import Data.Text (Text)+import GHC.Generics (Generic)+import Text.XML+import Text.XML.Cursor -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.Common-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.Common+import Codec.Xlsx.Writer.Internal -- | Logical operation used in 'CellIs' condition --@@ -46,7 +48,7 @@ | OpNotBetween Formula Formula -- ^ 'Not between' operator | OpNotContains Formula -- ^ 'Does not contain' operator | OpNotEqual Formula -- ^ 'Not equal to' operator- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) -- | Used in a "contains dates" conditional formatting rule. -- These are dynamic time periods, which change based on@@ -64,7 +66,7 @@ | PerToday -- ^ Today's date. | PerTomorrow -- ^ Tomorrow's date. | PerYesterday -- ^ Yesterday's date.- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) -- | Conditions which could be used for conditional formatting --@@ -129,7 +131,7 @@ -- TODO: timePeriod -- TODO: top10 -- TODO: uniqueValues- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) -- | This collection represents a description of a conditional formatting rule. --@@ -149,7 +151,7 @@ -- be applied over this rule, when this rule -- evaluates to true. , _cfrStopIfTrue :: Maybe Bool- } deriving (Eq, Ord, Show)+ } deriving (Eq, Ord, Show, Generic) makeLenses ''CfRule
src/Codec/Xlsx/Types/DataValidation.hs view
@@ -1,23 +1,25 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.DataValidation where -import Control.Lens.TH (makeLenses)-import Control.Monad ((>=>))-import Data.Char (isSpace)-import Data.Default-import qualified Data.Map as M-import Data.Maybe (catMaybes)-import Data.Monoid ((<>))-import Data.Text (Text)-import qualified Data.Text as T-import Text.XML (Node (..), Element (..))-import Text.XML.Cursor (Cursor, ($/), element)+import Control.Lens.TH (makeLenses)+import Control.Monad ((>=>))+import Data.Char (isSpace)+import Data.Default+import qualified Data.Map as M+import Data.Maybe (catMaybes)+import Data.Monoid ((<>))+import Data.Text (Text)+import qualified Data.Text as T+import GHC.Generics (Generic)+import Text.XML (Node(..), Element(..))+import Text.XML.Cursor (Cursor, ($/), element) -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.Common-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.Common+import Codec.Xlsx.Writer.Internal -- See 18.18.20 "ST_DataValidationOperator (Data Validation Operator)" (p. 2439/2449) data ValidationExpression@@ -29,7 +31,7 @@ | ValLessThanOrEqual Formula -- ^ "Less than or equal to" operator | ValNotBetween Formula Formula -- ^ "Not between" operator | ValNotEqual Formula -- ^ "Not equal to" operator- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- See 18.18.21 "ST_DataValidationType (Data Validation Type)" (p. 2440/2450) data ValidationType@@ -41,14 +43,14 @@ | ValidationTypeTextLength ValidationExpression | ValidationTypeTime ValidationExpression | ValidationTypeWhole ValidationExpression- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- See 18.18.18 "ST_DataValidationErrorStyle (Data Validation Error Styles)" (p. 2438/2448) data ErrorStyle = ErrorStyleInformation | ErrorStyleStop | ErrorStyleWarning- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- See 18.3.1.32 "dataValidation (Data Validation)" (p. 1614/1624) data DataValidation = DataValidation@@ -62,7 +64,7 @@ , _dvShowErrorMessage :: Bool , _dvShowInputMessage :: Bool , _dvValidationType :: ValidationType- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''DataValidation
src/Codec/Xlsx/Types/Drawing.hs view
@@ -8,6 +8,7 @@ {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeSynonymInstances #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Drawing where import Control.Arrow (first)@@ -18,6 +19,7 @@ import Data.Maybe (catMaybes, listToMaybe, mapMaybe) import Data.Text (Text) import qualified Data.Text as T+import GHC.Generics (Generic) import Text.XML import Text.XML.Cursor @@ -41,14 +43,14 @@ -- if interoperability is wanted , _fiContents :: ByteString -- ^ image file contents- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data Marker = Marker { _mrkCol :: Int , _mrkColOff :: Coordinate , _mrkRow :: Int , _mrkRowOff :: Coordinate- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) unqMarker :: (Int, Int) -> (Int, Int) -> Marker unqMarker (col, colOff) (row, rowOff) =@@ -58,7 +60,7 @@ = EditAsTwoCell | EditAsOneCell | EditAsAbsolute- deriving (Eq,Show)+ deriving (Eq, Show, Generic) data Anchoring = AbsoluteAnchor@@ -74,7 +76,7 @@ , tcaTo :: Marker , tcaEditAs :: EditAs }- deriving (Eq, Show)+ deriving (Eq, Show, Generic) data DrawingObject p g = Picture { _picMacro :: Maybe Text@@ -88,7 +90,7 @@ , _grChartSpace :: g , _grTransform :: Transform2D} -- TODO: sp, grpSp, graphicFrame, cxnSp, contentPart- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | basic function to create picture drawing object --@@ -147,21 +149,21 @@ , _cldPrintsWithSheet :: Bool -- ^ This attribute indicates whether to print drawing elements -- when printing the sheet.- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data PicNonVisual = PicNonVisual { _pnvDrawingProps :: NonVisualDrawingProperties -- TODO: cNvPicPr- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data GraphNonVisual = GraphNonVisual { _gnvDrawingProps :: NonVisualDrawingProperties -- TODO cNvGraphicFramePr- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) newtype DrawingElementId = DrawingElementId { unDrawingElementId :: Int- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- see 20.1.2.2.8 "cNvPr (Non-Visual Drawing Properties)" (p. 2731) data NonVisualDrawingProperties = NonVisualDrawingProperties@@ -178,13 +180,13 @@ -- ^ Alternative Text for Object , _nvdpHidden :: Bool , _nvdpTitle :: Maybe Text- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data BlipFillProperties a = BlipFillProperties { _bfpImageInfo :: Maybe a , _bfpFillMode :: Maybe FillMode -- TODO: dpi, rotWithShape, srcRect- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- see @a_EG_FillModeProperties@ (p. 4319) data FillMode@@ -192,14 +194,14 @@ = FillTile -- TODO: tx, ty, sx, sy, flip, algn -- See 20.1.8.56 "stretch (Stretch)" (p. 2879) | FillStretch -- TODO: srcRect- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- See @EG_Anchor@ (p. 4052) data Anchor p g = Anchor { _anchAnchoring :: Anchoring , _anchObject :: DrawingObject p g , _anchClientData :: ClientData- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | simple drawing object anchoring using one cell as a top lelft -- corner and dimensions of that object@@ -212,14 +214,14 @@ simpleAnchorXY (x, y) sz obj = Anchor { _anchAnchoring =- OneCellAnchor {onecaFrom = unqMarker (x, fromIntegral $ cm2emu 10) (y, 0), onecaExt = sz}+ OneCellAnchor {onecaFrom = unqMarker (x, 0) (y, 0), onecaExt = sz} , _anchObject = obj , _anchClientData = def } data GenericDrawing p g = Drawing { _xdrAnchors :: [Anchor p g]- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- See 20.5.2.35 "wsDr (Worksheet Drawing)" (p. 3176) type Drawing = GenericDrawing FileInfo ChartSpace
src/Codec/Xlsx/Types/Drawing/Chart.hs view
@@ -2,8 +2,11 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Drawing.Chart where +import GHC.Generics (Generic)+ import Control.Lens.TH import Data.Default import Data.Maybe (catMaybes, maybeToList)@@ -29,14 +32,14 @@ , _chspLegend :: Maybe Legend , _chspPlotVisOnly :: Maybe Bool , _chspDispBlanksAs :: Maybe DispBlanksAs- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Chart title -- -- TODO: layout, overlay, spPr, txPr, extLst newtype ChartTitle = ChartTitle TextBody- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | This simple type specifies the possible ways to display blanks. --@@ -48,13 +51,13 @@ -- ^ Specifies that blank values shall be spanned with a line. | DispBlanksAsZero -- ^ Specifies that blank values shall be treated as zero.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- TODO: legendEntry, layout, overlay, spPr, txPr, extLst data Legend = Legend { _legendPos :: Maybe LegendPos , _legendOverlay :: Maybe Bool- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- See 21.2.3.24 "ST_LegendPos (Legend Position)" (p. 3449) data LegendPos@@ -73,7 +76,7 @@ | LegendTopRight -- ^ tr (Top Right) Specifies that the legend shall be drawn at -- the top right of the chart.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Specific Chart -- TODO:@@ -101,7 +104,7 @@ | ScatterChart { _scchStyle :: ScatterStyle , _scchSeries :: [ScatterSeries] }- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Possible groupings for a bar chart --@@ -116,7 +119,7 @@ | StandardGrouping -- ^(Standard) Specifies that the chart series are drawn on the value -- axis.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Possible directions for a bar chart --@@ -124,7 +127,7 @@ data BarDirection = DirectionBar | DirectionColumn- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Possible styles of scatter chart --@@ -140,7 +143,7 @@ | ScatterMarker | ScatterSmooth | ScatterSmoothMarker- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Single data point options --@@ -150,7 +153,7 @@ data DataPoint = DataPoint { _dpMarker :: Maybe DataMarker , _dpShapeProperties :: Maybe ShapeProperties- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Specifies common series options -- TODO: spPr@@ -161,7 +164,7 @@ -- ^ specifies text for a series name, without rich text formatting -- currently only reference formula is supported , _serShapeProperties :: Maybe ShapeProperties- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | A series on a line chart --@@ -175,7 +178,7 @@ , _lnserVal :: Maybe Formula -- ^ currently only reference formula is supported , _lnserSmooth :: Maybe Bool- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | A series on an area chart --@@ -186,7 +189,7 @@ { _arserShared :: Series , _arserDataLblProps :: Maybe DataLblProps , _arserVal :: Maybe Formula- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | A series on a bar chart --@@ -198,7 +201,7 @@ { _brserShared :: Series , _brserDataLblProps :: Maybe DataLblProps , _brserVal :: Maybe Formula- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | A series on a pie chart --@@ -212,7 +215,7 @@ -- properly colored , _piserDataLblProps :: Maybe DataLblProps , _piserVal :: Maybe Formula- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | A series on a scatter chart --@@ -226,14 +229,14 @@ , _scserXVal :: Maybe Formula , _scserYVal :: Maybe Formula , _scserSmooth :: Maybe Bool- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- See @CT_Marker@ (p. 4061) data DataMarker = DataMarker { _dmrkSymbol :: Maybe DataMarkerSymbol , _dmrkSize :: Maybe Int -- ^ integer between 2 and 72, specifying a size in points- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data DataMarkerSymbol = DataMarkerCircle@@ -248,7 +251,7 @@ | DataMarkerTriangle | DataMarkerX | DataMarkerAuto- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Settings for the data labels for an entire series or the -- entire chart@@ -262,7 +265,7 @@ , _dlblShowCatName :: Maybe Bool , _dlblShowSerName :: Maybe Bool , _dlblShowPercent :: Maybe Bool- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Specifies the possible positions for tick marks. @@ -276,7 +279,7 @@ -- ^ (None) Specifies there shall be no tick marks. | TickMarkOut -- ^ (Outside) Specifies the tick marks shall be outside the plot area.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) makeLenses ''DataPoint
src/Codec/Xlsx/Types/Drawing/Common.hs view
@@ -2,8 +2,11 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Drawing.Common where +import GHC.Generics (Generic)+ import Control.Arrow (first) import Control.Lens.TH import Control.Monad (join)@@ -28,7 +31,7 @@ -- angles are counter-clockwise (i.e., towards the negative y axis). newtype Angle = Angle Int- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | A string with rich text formatting --@@ -58,7 +61,7 @@ -- aligns the text within the "bounds box" for the text. , _txbdParagraphs :: [TextParagraph] -- ^ Paragraphs of text within the containing text body- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Text vertical overflow -- See 20.1.10.83 "ST_TextVertOverflowType (Text Vertical Overflow)" (p. 3083)@@ -71,7 +74,7 @@ -- there is text which is not visible. | TextVertOverflow -- ^ Overflow the text and pay no attention to top and bottom barriers.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | If there is vertical text, determines what kind of vertical text is going to be used. --@@ -100,7 +103,7 @@ | TextVerticalWordArtRtl -- ^ Specifies that vertical WordArt should be shown from right to left rather than -- left to right.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Text wrapping types --@@ -111,7 +114,7 @@ -- paying attention to the bounding rectangle boundaries. | TextWrapSquare -- ^ Determines whether we wrap words within the bounding rectangle.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | This type specifies a list of available anchoring types for text. --@@ -137,13 +140,13 @@ -- text in a line, it does not justify. | TextAnchoringTop -- ^ Anchor the text at the top of the bounding rectangle.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- See 21.1.2.2.6 "p (Text Paragraphs)" (p. 3211) data TextParagraph = TextParagraph { _txpaDefCharProps :: Maybe TextCharacterProperties , _txpaRuns :: [TextRun]- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Text character properties --@@ -158,7 +161,7 @@ { _txchBold :: Bool , _txchItalic :: Bool , _txchUnderline :: Bool- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Text run --@@ -166,7 +169,7 @@ data TextRun = RegularRun { _txrCharProps :: Maybe TextCharacterProperties , _txrText :: Text- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | This simple type represents a one dimensional position or length --@@ -177,7 +180,7 @@ | UniversalMeasure UnitIdentifier Double -- ^ see 22.9.2.15 "ST_UniversalMeasure (Universal Measurement)" (p. 3793)- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Units used in "Universal measure" coordinates -- see 22.9.2.15 "ST_UniversalMeasure (Universal Measurement)" (p. 3793)@@ -188,13 +191,13 @@ | UnitPt -- "pt" 1 pt = 1/72 in (informative) | UnitPc -- "pc" 1 pc = 12 pt (informative) | UnitPi -- "pi" 1 pi = 12 pt (informative)- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- See @CT_Point2D@ (p. 3989) data Point2D = Point2D { _pt2dX :: Coordinate , _pt2dY :: Coordinate- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) unqPoint2D :: Int -> Int -> Point2D unqPoint2D x y = Point2D (UnqCoordinate x) (UnqCoordinate y)@@ -203,12 +206,12 @@ -- see 20.1.10.41 "ST_PositiveCoordinate (Positive Coordinate)" (p. 2942) newtype PositiveCoordinate = PositiveCoordinate Integer- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) data PositiveSize2D = PositiveSize2D { _ps2dX :: PositiveCoordinate , _ps2dY :: PositiveCoordinate- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) positiveSize2D :: Integer -> Integer -> PositiveSize2D positiveSize2D x y =@@ -235,14 +238,14 @@ , _trExtents :: Maybe PositiveSize2D -- ^ See 20.1.7.3 "ext (Extents)" (p. 2846) or -- 20.5.2.14 "ext (Shape Extent)" (p. 3165)- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- TODO: custGeom data Geometry = PresetGeometry -- TODO: prst, avList -- currently uses "rect" with empty avList- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- See 20.1.2.2.35 "spPr (Shape Properties)" (p. 2751) data ShapeProperties = ShapeProperties@@ -251,7 +254,7 @@ , _spFill :: Maybe FillProperties , _spOutline :: Maybe LineProperties -- TODO: bwMode, a_EG_EffectProperties, scene3d, sp3d, extLst- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Specifies an outline style that can be applied to a number of -- different objects such as shapes and text.@@ -266,7 +269,7 @@ -- ^ Specifies the width to be used for the underline stroke. The -- value is in EMU, is greater of equal to 0 and maximum value is -- 20116800.- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Color choice for some drawing element --@@ -280,7 +283,7 @@ -- digits, RRGGBB. A perceptual gamma of 2.2 is used. -- -- See 20.1.2.3.32 "srgbClr (RGB Color Model - Hex Variant)" (p. 2773)- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- TODO: gradFill, pattFill data FillProperties =@@ -289,7 +292,7 @@ | SolidFill (Maybe ColorChoice) -- ^ Solid fill -- See 20.1.8.54 "solidFill (Solid Fill)" (p. 2879)- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | solid fill with color specified by hexadecimal RGB color solidRgb :: Text -> FillProperties
src/Codec/Xlsx/Types/Internal.hs view
@@ -1,17 +1,19 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal where -import Control.Arrow-import Data.Text (Text)+import Control.Arrow+import Data.Text (Text)+import GHC.Generics (Generic) #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Writer.Internal -newtype RefId = RefId { unRefId :: Text } deriving (Show, Eq, Ord)+newtype RefId = RefId { unRefId :: Text } deriving (Eq, Ord, Show, Generic) instance ToAttrVal RefId where toAttrVal = toAttrVal . unRefId
src/Codec/Xlsx/Types/Internal/CfPair.hs view
@@ -1,13 +1,14 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.CfPair where -import Text.XML.Cursor--import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.Common-import Codec.Xlsx.Types.ConditionalFormatting-import Codec.Xlsx.Writer.Internal+import GHC.Generics (Generic)+import Text.XML.Cursor +import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.Common+import Codec.Xlsx.Types.ConditionalFormatting+import Codec.Xlsx.Writer.Internal -- | Internal helper type for parsing "conditionalFormatting recods -- TODO: pivot, extList@@ -16,7 +17,7 @@ -- See 18.3.1.18 "conditionalFormatting (Conditional Formatting)" (p. 1610) newtype CfPair = CfPair { unCfPair :: (SqRef, ConditionalFormatting)- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) instance FromCursor CfPair where fromCursor cur = do
src/Codec/Xlsx/Types/Internal/CommentTable.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.CommentTable where import Data.ByteString.Lazy (ByteString)@@ -12,6 +13,7 @@ import Data.Text.Lazy (toStrict) import qualified Data.Text.Lazy.Builder as B import qualified Data.Text.Lazy.Builder.Int as B+import GHC.Generics (Generic) import Safe import Text.XML import Text.XML.Cursor@@ -23,7 +25,7 @@ newtype CommentTable = CommentTable { _commentsTable :: Map CellRef Comment }- deriving (Show, Eq)+ deriving (Eq, Show, Generic) fromList :: [(CellRef, Comment)] -> CommentTable fromList = CommentTable . M.fromList
src/Codec/Xlsx/Types/Internal/ContentTypes.hs view
@@ -1,38 +1,40 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.ContentTypes where -import Control.Arrow-import Data.Foldable (asum)-import Data.Map (Map)-import qualified Data.Map as M-import Data.Text (Text)-import qualified Data.Text as T-import System.FilePath.Posix (takeExtension)-import Text.XML-import Text.XML.Cursor+import Control.Arrow+import Data.Foldable (asum)+import Data.Map (Map)+import qualified Data.Map as M+import Data.Text (Text)+import qualified Data.Text as T+import GHC.Generics (Generic)+import System.FilePath.Posix (takeExtension)+import Text.XML+import Text.XML.Cursor #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif -import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Parser.Internal data CtDefault = CtDefault { dfltExtension :: FilePath , dfltContentType :: Text- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data Override = Override { ovrPartName :: FilePath , ovrContentType :: Text- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data ContentTypes = ContentTypes { ctDefaults :: Map FilePath Text , ctTypes :: Map FilePath Text- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) lookup :: FilePath -> ContentTypes -> Maybe Text lookup path ContentTypes{..} =
src/Codec/Xlsx/Types/Internal/CustomProperties.hs view
@@ -1,18 +1,20 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.CustomProperties where -import Data.Map (Map)-import qualified Data.Map as M-import Data.Text (Text)-import Text.XML-import Text.XML.Cursor+import Data.Map (Map)+import qualified Data.Map as M+import Data.Text (Text)+import GHC.Generics (Generic)+import Text.XML+import Text.XML.Cursor -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.Variant-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.Variant+import Codec.Xlsx.Writer.Internal newtype CustomProperties = CustomProperties (Map Text Variant)- deriving (Show, Eq)+ deriving (Eq, Show, Generic) fromList :: [(Text, Variant)] -> CustomProperties fromList = CustomProperties . M.fromList
src/Codec/Xlsx/Types/Internal/DvPair.hs view
@@ -1,21 +1,22 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.DvPair where -import qualified Data.Map as M-import Text.XML (Element (..))--import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.Common-import Codec.Xlsx.Types.DataValidation-import Codec.Xlsx.Writer.Internal+import qualified Data.Map as M+import GHC.Generics (Generic)+import Text.XML (Element(..)) +import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.Common+import Codec.Xlsx.Types.DataValidation+import Codec.Xlsx.Writer.Internal -- | Internal helper type for parsing data validation records -- -- See 18.3.1.32 "dataValidation (Data Validation)" (p. 1614/1624) newtype DvPair = DvPair { unDvPair :: (SqRef, DataValidation)- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) instance FromCursor DvPair where fromCursor cur = do
src/Codec/Xlsx/Types/Internal/NumFmtPair.hs view
@@ -1,17 +1,19 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.NumFmtPair where -import Data.Text (Text)+import Data.Text (Text)+import GHC.Generics (Generic) -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Writer.Internal -- | Internal helper type for parsing "numFmt" recods -- -- See 18.8.30 "numFmt (Number Format)" (p. 1777) newtype NumFmtPair = NumFmtPair { unNumFmtPair :: (Int, Text)- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) instance FromCursor NumFmtPair where fromCursor cur = do
src/Codec/Xlsx/Types/Internal/Relationships.hs view
@@ -1,32 +1,34 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.Relationships where -import Data.List (find)-import Data.Map (Map)-import qualified Data.Map as Map-import Data.Monoid ((<>))-import Data.Text (Text)-import qualified Data.Text as T-import Network.URI hiding (path)-import Prelude hiding (abs, lookup)-import Safe-import Text.XML-import Text.XML.Cursor+import Data.List (find)+import Data.Map (Map)+import qualified Data.Map as Map+import Data.Monoid ((<>))+import Data.Text (Text)+import qualified Data.Text as T+import GHC.Generics (Generic)+import Network.URI hiding (path)+import Prelude hiding (abs, lookup)+import Safe+import Text.XML+import Text.XML.Cursor #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.Internal-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.Internal+import Codec.Xlsx.Writer.Internal data Relationship = Relationship { relType :: Text , relTarget :: FilePath- } deriving (Show, Eq)+ } deriving (Eq, Show, Generic) -- | Describes relationships according to Open Packaging Convention --@@ -34,7 +36,7 @@ -- Conventions newtype Relationships = Relationships { relMap :: Map RefId Relationship- } deriving (Show, Eq)+ } deriving (Eq, Show, Generic) fromList :: [(RefId, Relationship)] -> Relationships fromList = Relationships . Map.fromList
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Internal.SharedStringTable ( -- * Main types SharedStringTable(..)@@ -10,22 +11,22 @@ , sstEmpty ) where -import Control.Monad--import qualified Data.Map as Map-import Data.Maybe (mapMaybe)-import qualified Data.Set as Set-import Data.Text (Text)-import Data.Vector (Vector)-import qualified Data.Vector as V-import Numeric.Search.Range (searchFromTo)-import Safe (fromJustNote)-import Text.XML-import Text.XML.Cursor+import Control.Monad+import qualified Data.Map as Map+import Data.Maybe (mapMaybe)+import qualified Data.Set as Set+import Data.Text (Text)+import Data.Vector (Vector)+import qualified Data.Vector as V+import GHC.Generics (Generic)+import Numeric.Search.Range (searchFromTo)+import Safe (fromJustNote)+import Text.XML+import Text.XML.Cursor -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types+import Codec.Xlsx.Writer.Internal -- | Shared string table --@@ -47,7 +48,7 @@ newtype SharedStringTable = SharedStringTable { sstTable :: Vector XlsxText }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) sstEmpty :: SharedStringTable sstEmpty = SharedStringTable V.empty
src/Codec/Xlsx/Types/PageSetup.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.PageSetup ( -- * Main types PageSetup(..)@@ -36,10 +37,11 @@ import Control.Lens (makeLenses) import Data.Default+import qualified Data.Map as Map import Data.Maybe (catMaybes) import Data.Text (Text)+import GHC.Generics (Generic) import Text.XML-import qualified Data.Map as Map import Codec.Xlsx.Writer.Internal import Codec.Xlsx.Parser.Internal@@ -134,7 +136,7 @@ -- | Vertical print resolution of the device. , _pageSetupVerticalDpi :: Maybe Int }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Enumerations@@ -155,7 +157,7 @@ -- | Do not print cell comments | CellCommentsNone- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Print errors --@@ -173,14 +175,14 @@ -- | Display cell errors as @#N/A@ | PrintErrorsNA- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Print orientation for this sheet data Orientation = OrientationDefault | OrientationLandscape | OrientationPortrait- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Specifies printed page order data PageOrder =@@ -189,7 +191,7 @@ -- | Order pages horizontally first, then move vertically | PageOrderOverThenDown- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Paper size data PaperSize =@@ -259,7 +261,7 @@ | EnvelopeInvite -- ^ Invite envelope (220 mm by 220 mm) | EnvelopeItaly -- ^ Italy envelope (110 mm by 230 mm) | EnvelopeMonarch -- ^ Monarch envelope (3.875 in. by 7.5 in.).- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Default instances
src/Codec/Xlsx/Types/PivotTable.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.PivotTable ( PivotTable(..) , PivotFieldName(..)@@ -12,6 +13,7 @@ import Control.Arrow (first) import Data.Text (Text)+import GHC.Generics (Generic) import Codec.Xlsx.Types.Common import Codec.Xlsx.Parser.Internal@@ -31,14 +33,14 @@ , _pvtLocation :: CellRef , _pvtSrcSheet :: Text , _pvtSrcRef :: Range- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data PivotFieldInfo = PivotFieldInfo { _pfiName :: PivotFieldName , _pfiOutline :: Bool , _pfiSortType :: FieldSortType , _pfiHiddenItems :: [CellValue]- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Sort orders that can be applied to fields in a PivotTable --@@ -47,22 +49,22 @@ = FieldSortAscending | FieldSortDescending | FieldSortManual- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) newtype PivotFieldName = PivotFieldName Text- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) data PositionedField = DataPosition | FieldPosition PivotFieldName- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) data DataField = DataField { _dfField :: PivotFieldName , _dfName :: Text , _dfFunction :: ConsolidateFunction- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Data consolidation functions specified by the user and used to -- consolidate ranges of data@@ -99,7 +101,7 @@ | ConsolidateVarP -- ^ The variance of a population, where the population is all of -- the data to be summarized.- deriving (Eq, Show)+ deriving (Eq, Show, Generic) {------------------------------------------------------------------------------- Rendering
src/Codec/Xlsx/Types/PivotTable/Internal.hs view
@@ -1,11 +1,14 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.PivotTable.Internal ( CacheId(..) , CacheField(..) ) where +import GHC.Generics (Generic)+ import Control.Arrow (first) import Data.Maybe (catMaybes) import Text.XML@@ -20,12 +23,12 @@ import Codec.Xlsx.Types.PivotTable import Codec.Xlsx.Writer.Internal -newtype CacheId = CacheId Int deriving Eq+newtype CacheId = CacheId Int deriving (Eq, Generic) data CacheField = CacheField { cfName :: PivotFieldName , cfItems :: [CellValue]- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) {------------------------------------------------------------------------------- Parsing
src/Codec/Xlsx/Types/Protection.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Protection ( SheetProtection(..) , fullSheetProtection@@ -27,6 +28,8 @@ , sprSelectUnlockedCells ) where +import GHC.Generics (Generic)+ import Control.Arrow (first) import Control.Lens (makeLenses) import Data.Bits@@ -43,7 +46,7 @@ newtype LegacyPassword = LegacyPassword Text- deriving (Eq, Show)+ deriving (Eq, Show, Generic) -- | Creates legacy @XOR@ hashed password. --@@ -125,7 +128,7 @@ -- sheet is protected , _sprSort :: Bool -- ^ sorting should not be allowed when the sheet is protected- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''SheetProtection
src/Codec/Xlsx/Types/RichText.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.RichText ( -- * Main types RichTextRun(..)@@ -29,6 +30,8 @@ , runPropertiesVertAlign ) where +import GHC.Generics (Generic)+ import Control.Lens hiding (element) import Control.Monad import Data.Default@@ -66,7 +69,7 @@ -- Section 18.4.12, "t (Text)" (p. 1727) , _richTextRunText :: Text }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Run properties --@@ -171,7 +174,7 @@ -- Section 18.4.14, "vertAlign (Vertical Alignment)" (p. 1728) , _runPropertiesVertAlign :: Maybe FontVerticalAlignment }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Lenses
src/Codec/Xlsx/Types/SheetViews.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.SheetViews ( -- * Structured type to construct 'SheetViews' SheetView(..)@@ -46,6 +47,8 @@ , paneYSplit ) where +import GHC.Generics (Generic)+ import Control.Lens (makeLenses) import Data.Default import Data.Maybe (catMaybes, maybeToList, listToMaybe)@@ -176,7 +179,7 @@ -- Minimum of 0, maximum of 4 elements , _sheetViewSelection :: [Selection] }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Worksheet view selection. --@@ -199,7 +202,7 @@ -- | Range of the selection. Can be non-contiguous set of ranges. , _selectionSqref :: Maybe SqRef }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Worksheet view pane --@@ -226,7 +229,7 @@ -- the left pane. , _paneYSplit :: Maybe Double }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Enumerations@@ -244,7 +247,7 @@ -- | Page layout view | SheetViewTypePageLayout- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Pane type --@@ -277,7 +280,7 @@ -- dividing the pane into right and left regions. In that case, this value -- specifies the right pane. | PaneTypeTopRight- deriving (Eq, Show, Ord)+ deriving (Eq, Ord, Show, Generic) -- | State of the sheet's pane. --@@ -295,7 +298,7 @@ -- | Panes are split, but not frozen. In this state, the split bars are -- adjustable by the user. | PaneStateSplit- deriving (Eq, Show, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Lenses
src/Codec/Xlsx/Types/StyleSheet.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} -- | Support for writing (but not reading) style sheets module Codec.Xlsx.Types.StyleSheet ( -- * The main two types@@ -126,26 +127,25 @@ , firstUserNumFmtId ) where -import Control.Lens hiding (element, elements,- (.=))-import Data.Default-import Data.Map.Strict (Map)-import qualified Data.Map.Strict as M-import Data.Maybe (catMaybes)-import Data.Monoid-import Data.Text (Text)-import qualified Data.Text as T-import Text.XML-import Text.XML.Cursor-+import Control.Lens hiding (element, elements, (.=))+import Data.Default+import Data.Map.Strict (Map)+import qualified Data.Map.Strict as M+import Data.Maybe (catMaybes)+import Data.Monoid+import Data.Text (Text)+import qualified Data.Text as T+import GHC.Generics (Generic)+import Text.XML+import Text.XML.Cursor #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Types.Internal.NumFmtPair-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Types.Internal.NumFmtPair+import Codec.Xlsx.Writer.Internal {------------------------------------------------------------------------------- The main types@@ -229,7 +229,7 @@ -- This element contains custom number formats defined in this style sheet -- -- Section 18.8.31, "numFmts (Number Formats)" (p. 1784)- } deriving (Eq, Ord, Show)+ } deriving (Eq, Ord, Show, Generic) -- | Cell formatting --@@ -316,7 +316,7 @@ -- not take effect unless the sheet has been protected. , _cellXfProtection :: Maybe Protection }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Supporting record types@@ -365,7 +365,7 @@ -- within the cell. , _alignmentWrapText :: Maybe Bool }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Expresses a single set of cell border formats (left, right, top, bottom, -- diagonal). Color is optional. When missing, 'automatic' is implied.@@ -423,7 +423,7 @@ -- | Vertical inner border , _borderVertical :: Maybe BorderStyle }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Border style -- See @CT_BorderPr@ (p. 3934)@@ -431,7 +431,7 @@ _borderStyleColor :: Maybe Color , _borderStyleLine :: Maybe LineStyle }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | One of the colors associated with the data bar or color scale. --@@ -465,7 +465,7 @@ -- 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change. , _colorTint :: Maybe Double }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | This element specifies fill formatting. --@@ -477,7 +477,7 @@ data Fill = Fill { _fillPattern :: Maybe FillPattern }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | This element is used to specify cell fill information for pattern and solid -- color cell fills. For solid cell fills (no pattern), fgColor is used. For@@ -490,7 +490,7 @@ , _fillPatternFgColor :: Maybe Color , _fillPatternType :: Maybe PatternType }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | This element defines the properties for one of the fonts used in this -- workbook.@@ -592,7 +592,7 @@ -- is available) accordingly. , _fontVertAlign :: Maybe FontVerticalAlignment }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | A single dxf record, expressing incremental formatting to be applied. --@@ -605,7 +605,7 @@ , _dxfBorder :: Maybe Border , _dxfProtection :: Maybe Protection -- TODO: extList- } deriving (Eq, Ord, Show)+ } deriving (Eq, Ord, Show, Generic) type NumFmt = Text @@ -616,7 +616,7 @@ data NumberFormat = StdNumberFormat ImpliedNumberFormat | UserNumberFormat NumFmt- deriving (Eq, Ord, Show)+ deriving (Eq, Ord, Show, Generic) -- | Basic number format with predefined number of decimals -- as format code of number format in xlsx should be less than 255 characters@@ -665,7 +665,7 @@ | NfExponent1Decimal -- ^> 48 ##0.0E+0 | NfTextPlaceHolder -- ^> 49 @ | NfOtherImplied Int -- ^ other (non local-neutral?) built-in format (id < 164)- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) stdNumberFormatId :: ImpliedNumberFormat -> Int stdNumberFormatId NfGeneral = 0 -- General@@ -743,7 +743,7 @@ _protectionHidden :: Maybe Bool , _protectionLocked :: Maybe Bool }- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Enumerations@@ -761,7 +761,7 @@ | CellHorizontalAlignmentJustify | CellHorizontalAlignmentLeft | CellHorizontalAlignmentRight- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Vertical alignment in cells --@@ -772,7 +772,7 @@ | CellVerticalAlignmentDistributed | CellVerticalAlignmentJustify | CellVerticalAlignmentTop- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Font family --@@ -796,7 +796,7 @@ -- | Novelty font | FontFamilyDecorative- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Font scheme --@@ -810,7 +810,7 @@ -- | This font is not a theme font. | FontSchemeNone- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Font underline property --@@ -821,7 +821,7 @@ | FontUnderlineSingleAccounting | FontUnderlineDoubleAccounting | FontUnderlineNone- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Vertical alignment --@@ -830,7 +830,7 @@ FontVerticalAlignmentBaseline | FontVerticalAlignmentSubscript | FontVerticalAlignmentSuperscript- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) data LineStyle = LineStyleDashDot@@ -847,7 +847,7 @@ | LineStyleSlantDashDot | LineStyleThick | LineStyleThin- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Indicates the style of fill pattern being used for a cell format. --@@ -872,7 +872,7 @@ | PatternTypeMediumGray | PatternTypeNone | PatternTypeSolid- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) -- | Reading order --@@ -881,7 +881,7 @@ ReadingOrderContextDependent | ReadingOrderLeftToRight | ReadingOrderRightToLeft- deriving (Show, Eq, Ord)+ deriving (Eq, Ord, Show, Generic) {------------------------------------------------------------------------------- Lenses
src/Codec/Xlsx/Types/Table.hs view
@@ -2,16 +2,18 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Table where import Control.Lens (makeLenses)-import Data.Maybe (maybeToList)+import Data.Maybe (catMaybes, maybeToList) import Data.Text (Text)+import GHC.Generics (Generic) import Text.XML import Text.XML.Cursor #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif import Codec.Xlsx.Parser.Internal@@ -43,7 +45,7 @@ -- it, and it shall be unique amongst all other displayNames and -- definedNames in the workbook. The character lengths and -- restrictions are the same as for definedNames .- , tblName :: Text+ , tblName :: Maybe Text -- ^ A string representing the name of the table that is used to -- reference the table programmatically through the spreadsheet -- applications object model. This string shall be unique per table@@ -59,7 +61,7 @@ -- ^ columns of this table, specification requires any table to -- include at least 1 column , tblAutoFilter :: Maybe AutoFilter- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) -- | Single table column --@@ -72,7 +74,7 @@ -- column. This is what shall be displayed in the header row in the -- UI, and is referenced through functions. This name shall be -- unique per table.- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) makeLenses ''Table @@ -83,7 +85,7 @@ instance FromCursor Table where fromCursor c = do tblDisplayName <- fromAttribute "displayName" c- tblName <- fromAttribute "name" c+ tblName <- maybeAttribute "name" c tblRef <- fromAttribute "ref" c tblAutoFilter <- maybeFromElement (n_ "autoFilter") c let tblColumns =@@ -106,8 +108,10 @@ attrs = [ "id" .= i , "displayName" .= tblDisplayName- , "name" .= tblName , "ref" .= tblRef+ ] +++ catMaybes+ [ "name" .=? tblName ] subElements = maybeToList (toElement "autoFilter" <$> tblAutoFilter) ++
src/Codec/Xlsx/Types/Variant.hs view
@@ -1,16 +1,18 @@ {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Types.Variant where -import Data.ByteString (ByteString)-import Data.ByteString.Base64 as B64-import Data.Text (Text)-import qualified Data.Text as T-import qualified Data.Text.Encoding as T-import Text.XML-import Text.XML.Cursor+import Data.ByteString (ByteString)+import Data.ByteString.Base64 as B64+import Data.Text (Text)+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import GHC.Generics (Generic)+import Text.XML+import Text.XML.Cursor -import Codec.Xlsx.Parser.Internal-import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Parser.Internal+import Codec.Xlsx.Writer.Internal data Variant = VtBlob ByteString@@ -22,7 +24,7 @@ -- vt_i4, vt_i8, vt_ui1, vt_ui2, vt_ui4, vt_ui8, vt_uint, vt_r4, vt_r8, -- vt_lpstr, vt_bstr, vt_date, vt_filetime, vt_cy, vt_error, vt_stream, -- vt_ostream, vt_storage, vt_ostorage, vt_vstream, vt_clsid- deriving (Eq, Show)+ deriving (Eq, Show, Generic) {------------------------------------------------------------------------------- Parsing
src/Codec/Xlsx/Writer.hs view
@@ -2,53 +2,58 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-}+{-# LANGUAGE DeriveGeneric #-} -- | This module provides a function for serializing structured `Xlsx` into lazy bytestring module Codec.Xlsx.Writer- ( fromXlsx- ) where+ ( fromXlsx+ ) where -import qualified Codec.Archive.Zip as Zip-import Control.Arrow (second)-import Control.Lens hiding (transform, (.=))-import Control.Monad (forM)-import qualified Data.ByteString.Lazy as L-import Data.ByteString.Lazy.Char8 ()-import Data.List (foldl', mapAccumL)-import Data.Map (Map)-import Data.STRef-import Control.Monad.ST-import qualified Data.Map as M-import Data.Maybe-import Data.Monoid ((<>))-import Data.Text (Text)-import Data.Tuple.Extra (fst3, snd3, thd3)-import qualified Data.Text as T-import Data.Time (UTCTime)-import Data.Time.Clock.POSIX (POSIXTime, posixSecondsToUTCTime)-import Data.Time.Format (formatTime)+import qualified Codec.Archive.Zip as Zip+import Control.Arrow (second)+import Control.Lens hiding (transform, (.=))+import Control.Monad (forM)+import Control.Monad.ST+import qualified Data.ByteString.Lazy as L+import Data.ByteString.Lazy.Char8 ()+import Data.List (foldl', mapAccumL)+import Data.Map (Map)+import qualified Data.Map as M+import Data.Maybe+import Data.Maybe (maybeToList)+import Data.Monoid ((<>))+import Data.STRef+import Data.Text (Text)+import qualified Data.Text as T+import Data.Time (UTCTime)+import Data.Time.Clock.POSIX (POSIXTime, posixSecondsToUTCTime)+import Data.Time.Format (formatTime) #if MIN_VERSION_time(1,5,0)-import Data.Time.Format (defaultTimeLocale)+import Data.Time.Format (defaultTimeLocale) #else-import System.Locale (defaultTimeLocale)+import System.Locale (defaultTimeLocale) #endif-import Safe-import Text.XML+import Data.Tuple.Extra (fst3, snd3, thd3)+import GHC.Generics (Generic)+import Safe+import Text.XML #if !MIN_VERSION_base(4,8,0)-import Control.Applicative+import Control.Applicative #endif -import Codec.Xlsx.Types-import Codec.Xlsx.Types.Internal-import Codec.Xlsx.Types.Internal.CfPair-import qualified Codec.Xlsx.Types.Internal.CommentTable as CommentTable-import Codec.Xlsx.Types.Internal.CustomProperties-import Codec.Xlsx.Types.Internal.DvPair-import Codec.Xlsx.Types.Internal.Relationships as Relationships hiding (lookup)-import Codec.Xlsx.Types.Internal.SharedStringTable-import Codec.Xlsx.Types.PivotTable.Internal-import Codec.Xlsx.Writer.Internal-import Codec.Xlsx.Writer.Internal.PivotTable+import Codec.Xlsx.Types+import Codec.Xlsx.Types.Internal+import Codec.Xlsx.Types.Internal.CfPair+import qualified Codec.Xlsx.Types.Internal.CommentTable+ as CommentTable+import Codec.Xlsx.Types.Internal.CustomProperties+import Codec.Xlsx.Types.Internal.DvPair+import Codec.Xlsx.Types.Internal.Relationships as Relationships+ hiding (lookup)+import Codec.Xlsx.Types.Internal.SharedStringTable+import Codec.Xlsx.Types.PivotTable.Internal+import Codec.Xlsx.Writer.Internal+import Codec.Xlsx.Writer.Internal.PivotTable -- | Writes `Xlsx' to raw data (lazy bytestring) fromXlsx :: POSIXTime -> Xlsx -> L.ByteString@@ -164,16 +169,23 @@ sheetDataXml rows rh = map rowEl rows where rowEl (r, cells) = elementList "row"- (ht ++ s ++ [("r", txti r) ,("hidden", "false"), ("outlineLevel", "0"),- ("collapsed", "false"), ("customFormat", "true"),- ("customHeight", txtb hasHeight)])+ (ht ++ s +++ [("r", txti r), ("hidden", txtb hidden), ("outlineLevel", "0"),+ ("collapsed", "false"), ("customFormat", "true"),+ ("customHeight", txtb hasHeight)]) $ map (cellEl r) cells where- (ht, hasHeight, s) = case M.lookup r rh of- Just (RowProps (Just h) (Just st)) -> ([("ht", txtd h)], True,[("s", txti st)])- Just (RowProps Nothing (Just st)) -> ([], True, [("s", txti st)])- Just (RowProps (Just h) Nothing ) -> ([("ht", txtd h)], True,[])- _ -> ([], False,[])+ mProps = M.lookup r rh+ hasHeight = case rowHeight =<< mProps of+ Just CustomHeight{} -> True+ _ -> False+ ht = do Just height <- [rowHeight =<< mProps]+ let h = case height of CustomHeight x -> x+ AutomaticHeight x -> x+ return ("ht", txtd h)+ s = do Just st <- [rowStyle =<< mProps]+ return ("s", txti st)+ hidden = fromMaybe False $ rowHidden <$> mProps cellEl r (icol, cell) = elementList "c" (cellAttrs (singleCellRef (r, icol)) cell) (catMaybes [ elementContent "v" . value <$> xlsxCellValue cell@@ -404,13 +416,13 @@ data XlsxCellData = XlsxSS Int | XlsxDouble Double | XlsxBool Bool- deriving (Show, Eq)+ deriving (Eq, Show, Generic) data XlsxCell = XlsxCell { xlsxCellStyle :: Maybe Int , xlsxCellValue :: Maybe XlsxCellData , xlsxComment :: Maybe Comment , xlsxCellFormula :: Maybe CellFormula- } deriving (Show, Eq)+ } deriving (Eq, Show, Generic) xlsxCellType :: XlsxCell -> Text xlsxCellType XlsxCell{xlsxCellValue=Just(XlsxSS _)} = "s"
src/Codec/Xlsx/Writer/Internal.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Writer.Internal ( -- * Rendering documents ToDocument(..)@@ -37,16 +38,16 @@ , justFalse ) where -import Data.Text (Text)-import qualified Data.Text as T-import Data.Text.Lazy (toStrict)-import Data.Text.Lazy.Builder (toLazyText)-import Data.Text.Lazy.Builder.Int-import Data.Text.Lazy.Builder.RealFloat+import Data.Text (Text)+import qualified Data.Text as T+import Data.Text.Lazy (toStrict)+import Data.Text.Lazy.Builder (toLazyText)+import Data.Text.Lazy.Builder.Int+import Data.Text.Lazy.Builder.RealFloat -import qualified Data.Map as Map-import Data.String (fromString)-import Text.XML+import qualified Data.Map as Map+import Data.String (fromString)+import Text.XML {------------------------------------------------------------------------------- Rendering documents
src/Codec/Xlsx/Writer/Internal/PivotTable.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveGeneric #-} module Codec.Xlsx.Writer.Internal.PivotTable ( PivotTableFiles(..) , renderPivotTableFiles@@ -10,11 +11,12 @@ import qualified Data.Map as M import Data.Maybe (catMaybes, fromMaybe, mapMaybe) import Data.Text (Text)+import GHC.Generics (Generic) import Safe (fromJustNote) import Text.XML -import Codec.Xlsx.Types.Common import Codec.Xlsx.Types.Cell+import Codec.Xlsx.Types.Common import Codec.Xlsx.Types.PivotTable import Codec.Xlsx.Types.PivotTable.Internal import Codec.Xlsx.Writer.Internal@@ -22,13 +24,13 @@ data PivotTableFiles = PivotTableFiles { pvtfTable :: ByteString , pvtfCacheDefinition :: ByteString- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) data CacheDefinition = CacheDefinition { cdSourceRef :: CellRef , cdSourceSheet :: Text , cdFields :: [CacheField]- } deriving (Eq, Show)+ } deriving (Eq, Show, Generic) renderPivotTableFiles :: CellMap -> Int -> PivotTable -> PivotTableFiles renderPivotTableFiles cm cacheId t = PivotTableFiles {..}
test/Main.hs view
@@ -85,7 +85,7 @@ (CustomFilter FltrLessThan "42"))] tables = [ Table- { tblName = "Table1"+ { tblName = Just "Table1" , tblDisplayName = "Table1" , tblRef = CellRef "A3" , tblColumns = [TableColumn "another text"]@@ -100,7 +100,10 @@ sheet2 = def & wsCells .~ testCellMap2 pvSheet = sheetWithPvCells & wsPivotTables .~ [testPivotTable] sheetWithPvCells = def & wsCells .~ testPivotSrcCells- rowProps = M.fromList [(1, RowProps (Just 50) (Just 3))]+ rowProps = M.fromList [(1, RowProps { rowHeight = Just (CustomHeight 50)+ , rowStyle = Just 3+ , rowHidden = False+ })] cols = [ColumnsProperties 1 10 (Just 15) (Just 1) False False False] drawing = Just $ testDrawing { _xdrAnchors = map resolve $ _xdrAnchors testDrawing } resolve :: Anchor RefId RefId -> Anchor FileInfo ChartSpace
xlsx.cabal view
@@ -1,6 +1,6 @@ Name: xlsx -Version: 0.5.0+Version: 0.6.0 Synopsis: Simple and incomplete Excel file parser/writer Description: