Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data SharedStringTable = SharedStringTable {}
- data StringItem
- sstConstruct :: [Worksheet] -> SharedStringTable
- sstLookupText :: SharedStringTable -> Text -> Int
- sstLookupRich :: SharedStringTable -> [RichTextRun] -> Int
- sstItem :: SharedStringTable -> Int -> StringItem
- sharedStringTable :: Iso' SharedStringTable (Vector StringItem)
Main types
data SharedStringTable Source
Shared string table
A workbook can contain thousands of cells containing string (non-numeric) data. Furthermore this data is very likely to be repeated across many rows or columns. The goal of implementing a single string table that is shared across the workbook is to improve performance in opening and saving the file by only reading and writing the repetitive information once.
Relevant parts of the EMCA standard (2nd edition, part 1, http://www.ecma-international.org/publications/standards/Ecma-376.htm), page numbers refer to the page in the PDF rather than the page number as printed on the page):
- Section 18.4, "Shared String Table" (p. 1712) in particular subsection 18.4.9, "sst (Shared String Table)" (p. 1726)
TODO: The extLst
child element is currently unsupported.
data StringItem Source
String Item
This element is the representation of an individual string in the Shared String table.
The spec says: "If the string is just a simple string with formatting applied at the cell level, then the String Item (si) should contain a single text element used to express the string. However, if the string in the cell is more complex - i.e., has formatting applied at the character level - then the string item shall consist of multiple rich text runs which collectively are used to express the string.". So we have either a single Text field, or else a list of RichTextRuns, each of which is some Text with layout properties.
TODO: Currently we do not support phoneticPr
(Phonetic Properties, 18.4.3,
p. 1723) or rPh
(Phonetic Run, 18.4.6, p. 1725).
Section 18.4.8, "si (String Item)" (p. 1725)
Eq StringItem Source | |
Ord StringItem Source | |
Show StringItem Source | |
ToElement StringItem Source | See |
FromCursor StringItem Source | See |
sstConstruct :: [Worksheet] -> SharedStringTable Source
Construct the SharedStringsTable
from an existing document
sstLookupText :: SharedStringTable -> Text -> Int Source
sstLookupRich :: SharedStringTable -> [RichTextRun] -> Int Source
sstItem :: SharedStringTable -> Int -> StringItem Source