| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Codec.Xlsx.Formatted
Contents
Description
Higher level interface for creating styled worksheets
- data FormattedCell = FormattedCell {
- _formattedAlignment :: Maybe Alignment
- _formattedBorder :: Maybe Border
- _formattedFill :: Maybe Fill
- _formattedFont :: Maybe Font
- _formattedNumberFormat :: Maybe NumberFormat
- _formattedProtection :: Maybe Protection
- _formattedPivotButton :: Maybe Bool
- _formattedQuotePrefix :: Maybe Bool
- _formattedValue :: Maybe CellValue
- _formattedColSpan :: Int
- _formattedRowSpan :: Int
- data Formatted = Formatted {}
- formatted :: Map (Int, Int) FormattedCell -> StyleSheet -> Formatted
- formattedAlignment :: Lens' FormattedCell (Maybe Alignment)
- formattedBorder :: Lens' FormattedCell (Maybe Border)
- formattedFill :: Lens' FormattedCell (Maybe Fill)
- formattedFont :: Lens' FormattedCell (Maybe Font)
- formattedNumberFormat :: Lens' FormattedCell (Maybe NumberFormat)
- formattedProtection :: Lens' FormattedCell (Maybe Protection)
- formattedPivotButton :: Lens' FormattedCell (Maybe Bool)
- formattedQuotePrefix :: Lens' FormattedCell (Maybe Bool)
- formattedValue :: Lens' FormattedCell (Maybe CellValue)
- formattedColSpan :: Lens' FormattedCell Int
- formattedRowSpan :: Lens' FormattedCell Int
Documentation
data FormattedCell Source #
Cell with formatting
See formatted for more details.
TODOs:
- Add a number format (
_cellXfApplyNumberFormat,_cellXfNumFmtId) - Add references to the named style sheets (
_cellXfId)
Constructors
Instances
Result of formatting
See formatted
Constructors
| Formatted | |
Fields
| |
formatted :: Map (Int, Int) 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
Celldatatype wants anIntfor the style, which is supposed to point into the_styleSheetCellXfspart 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 FormattedCells,
which refer directly to Fonts, Borders, 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.