xlsx-0.3.0: Simple and incomplete Excel file parser/writer

Codec.Xlsx.Formatted

Description

Higher level interface for creating styled worksheets

Synopsis

# Documentation

Cell with formatting. _cellStyle property of _formattedCell is ignored

See formatted for more details.

Constructors

 FormattedCell Fields_formattedCell :: Cell _formattedFormat :: Format _formattedColSpan :: Int _formattedRowSpan :: Int

Instances

 Source # Methods Source # MethodsshowList :: [FormattedCell] -> ShowS # Source # Methods

data Formatted Source #

Result of formatting

See formatted

Constructors

 Formatted FieldsformattedCellMap :: CellMapThe final CellMap; see _wsCellsformattedStyleSheet :: StyleSheetThe final stylesheet; see _xlStyles (and renderStyleSheet)formattedMerges :: [Range]The final list of cell merges; see _wsMerges

Instances

 Source # Methods Source # MethodsshowList :: [Formatted] -> ShowS #

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 an Int 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 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.

reverse to formatted which allows to get a map of formatted cells from an existing worksheet and its workbook's style sheet

Constructors

 CondFormatted FieldscondformattedStyleSheet :: StyleSheetThe resulting stylesheetcondformattedFormattings :: Map SqRef ConditionalFormattingThe final map of conditional formatting rules applied to ranges

Instances

 Source # Methods Source # MethodsshowList :: [CondFormatted] -> ShowS #

# Lenses

## FormattedCondFmt

condfmtDxf :: Lens' FormattedCondFmt Dxf Source #

condfmtPriority :: Lens' FormattedCondFmt Int Source #

condfmtStopIfTrue :: Lens' FormattedCondFmt (Maybe Bool) Source #