Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Higher level interface for creating styled worksheets
Synopsis
- data FormattedCell = FormattedCell {}
- data Formatted = Formatted {}
- data Format = Format {}
- formatted :: Map (RowIndex, ColumnIndex) FormattedCell -> StyleSheet -> Formatted
- formatWorkbook :: [(Text, Map (RowIndex, ColumnIndex) FormattedCell)] -> StyleSheet -> Xlsx
- toFormattedCells :: CellMap -> [Range] -> StyleSheet -> Map (RowIndex, ColumnIndex) FormattedCell
- data CondFormatted = CondFormatted {}
- conditionallyFormatted :: Map CellRef [FormattedCondFmt] -> StyleSheet -> CondFormatted
- formatAlignment :: Lens' Format (Maybe Alignment)
- formatBorder :: Lens' Format (Maybe Border)
- formatFill :: Lens' Format (Maybe Fill)
- formatFont :: Lens' Format (Maybe Font)
- formatNumberFormat :: Lens' Format (Maybe NumberFormat)
- formatProtection :: Lens' Format (Maybe Protection)
- formatPivotButton :: Lens' Format (Maybe Bool)
- formatQuotePrefix :: Lens' Format (Maybe Bool)
- formattedCell :: Lens' FormattedCell Cell
- formattedFormat :: Lens' FormattedCell Format
- formattedColSpan :: Lens' FormattedCell Int
- formattedRowSpan :: Lens' FormattedCell Int
- condfmtCondition :: Lens' FormattedCondFmt Condition
- condfmtDxf :: Lens' FormattedCondFmt Dxf
- condfmtPriority :: Lens' FormattedCondFmt Int
- condfmtStopIfTrue :: Lens' FormattedCondFmt (Maybe Bool)
Documentation
data FormattedCell Source #
Cell with formatting. _cellStyle
property of _formattedCell
is ignored
See formatted
for more details.
Instances
Result of formatting
See formatted
Formatted | |
|
Instances
Generic Formatted Source # | |
Show Formatted Source # | |
Eq Formatted Source # | |
type Rep Formatted Source # | |
Defined in Codec.Xlsx.Formatted type Rep Formatted = D1 ('MetaData "Formatted" "Codec.Xlsx.Formatted" "xlsx-1.1.0.1-FKUF1Jx3xuq9irRu3xJWCs" 'False) (C1 ('MetaCons "Formatted" 'PrefixI 'True) (S1 ('MetaSel ('Just "formattedCellMap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CellMap) :*: (S1 ('MetaSel ('Just "formattedStyleSheet") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 StyleSheet) :*: S1 ('MetaSel ('Just "formattedMerges") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Range])))) |
Formatting options used to format cells
TODOs:
- Add a number format (
_cellXfApplyNumberFormat
,_cellXfNumFmtId
) - Add references to the named style sheets (
_cellXfId
)
Instances
formatted :: Map (RowIndex, ColumnIndex) FormattedCell -> StyleSheet -> Formatted Source #
Higher level API for creating formatted documents
Creating formatted Excel spreadsheets using the Cell
datatype directly,
even with the support for the StyleSheet
datatype, is fairly painful.
This has a number of causes:
- The
Cell
datatype wants anInt
for the style, which is supposed to point into the_styleSheetCellXfs
part of a stylesheet. However, this can be difficult to work with, as it requires manual tracking of cell style IDs, which in turns requires manual tracking of font IDs, border IDs, etc. - Row-span and column-span properties are set on the worksheet as a whole
(
wsMerges
) rather than on individual cells. - Excel does not correctly deal with borders on cells that span multiple columns or rows. Instead, these rows must be set on all the edge cells in the block. Again, this means that this becomes a global property of the spreadsheet rather than properties of individual cells.
This function deals with all these problems. Given a map of FormattedCell
s,
which refer directly to Font
s, Border
s, etc. (rather than font IDs,
border IDs, etc.), and an initial stylesheet, it recovers all possible
sharing, constructs IDs, and then constructs the final CellMap
, as well as
the final stylesheet and list of merges.
If you don't already have a StyleSheet
you want to use as starting point
then minimalStyleSheet
is a good choice.
formatWorkbook :: [(Text, Map (RowIndex, ColumnIndex) FormattedCell)] -> StyleSheet -> Xlsx Source #
Build an Xlsx
, render provided cells as per the StyleSheet
.
toFormattedCells :: CellMap -> [Range] -> StyleSheet -> Map (RowIndex, ColumnIndex) FormattedCell Source #
reverse to formatted
which allows to get a map of formatted cells
from an existing worksheet and its workbook's style sheet
data CondFormatted Source #
CondFormatted | |
|
Instances
conditionallyFormatted :: Map CellRef [FormattedCondFmt] -> StyleSheet -> CondFormatted Source #
Lenses
Format
FormattedCell
FormattedCondFmt
condfmtCondition :: Lens' FormattedCondFmt Condition Source #
condfmtDxf :: Lens' FormattedCondFmt Dxf Source #
condfmtPriority :: Lens' FormattedCondFmt Int Source #