Logo GenPRES

Xlsx Module

Reads the sheets of an xlsx workbook as rows of text.

Types

Type Description

Sheet

A sheet of a workbook.

Functions and values

Function or value Description

cellText shared cell

Full Usage: cellText shared cell

Parameters:
Returns: string

Returns the text of a cell. A shared or inline string is the string, a boolean is TRUE or FALSE, a number is written by numberText, and an error cell or a cell without a value is empty.

shared : string[]
cell : XElement
Returns: string

columnIndex cellRef

Full Usage: columnIndex cellRef

Parameters:
    cellRef : string

Returns: int

Returns the zero-based column index of a cell reference: A1 gives 0, AB12 gives 27.

cellRef : string
Returns: int

docRelNs

Full Usage: docRelNs

Returns: XNamespace

The namespace of the relationship id attribute on a sheet element of the workbook.

Returns: XNamespace

folderOf path

Full Usage: folderOf path

Parameters:
    path : string

Returns: string

Returns the folder of an entry name: xl/workbook.xml gives xl, a name without a folder gives the empty text.

path : string
Returns: string

itemText item

Full Usage: itemText item

Parameters:
Returns: string

Joins the text elements of a string item, leaving out the phonetic hints.

item : XElement
Returns: string

mainNs

Full Usage: mainNs

Returns: XNamespace

The namespace of the worksheet, workbook and shared strings elements.

Returns: XNamespace

numberText s

Full Usage: numberText s

Parameters:
    s : string

Returns: string

Returns a stored number as a plain decimal with at most 15 significant digits, the precision of a spreadsheet number: 30.0 gives 30, 2.4E7 gives 24000000, 9.129E-5 gives 0.00009129, and the floating point result 0.16699999999999998 gives 0.167. Text that is not a number is returned unchanged.

s : string
Returns: string

packageRelNs

Full Usage: packageRelNs

Returns: XNamespace

The namespace of the elements in a relationships part.

Returns: XNamespace

plainFormat

Full Usage: plainFormat

Returns: string

The format that writes a double as a plain decimal with at most 15 significant digits. A double has at most 324 decimals before its 15 significant digits end, so 339 decimal places write every double without an exponent.

Returns: string

read bytes

Full Usage: read bytes

Parameters:
    bytes : byte[]

Returns: Result<Map<string, Sheet>, string>

Reads every sheet of an xlsx workbook, by sheet name. The workbook is the office document that the package relationships in _rels/.rels name. Returns an error when the bytes are not an xlsx workbook or the workbook cannot be read.

bytes : byte[]
Returns: Result<Map<string, Sheet>, string>

readSheet shared doc

Full Usage: readSheet shared doc

Parameters:
Returns: Sheet

Reads one worksheet. Rows marked hidden are left out and, when they have text, counted. Rows without any text are left out, and the cells are trimmed.

shared : string[]
doc : XDocument
Returns: Sheet

relationships part doc

Full Usage: relationships part doc

Parameters:
Returns: (string * string * string) list

Reads the relationships of a part from its relationships document as (id, type, entry name) triples.

part : string
doc : XDocument
Returns: (string * string * string) list

relationshipsPath part

Full Usage: relationshipsPath part

Parameters:
    part : string

Returns: string

Returns the entry name of the relationships of a part: xl/workbook.xml gives xl/_rels/workbook.xml.rels, and the package itself, the empty text, gives _rels/.rels.

part : string
Returns: string

resolveTarget folder target

Full Usage: resolveTarget folder target

Parameters:
    folder : string
    target : string

Returns: string

Resolves the target of a relationship against the folder of the part that has the relationship. A target that starts with a slash starts at the package root. Returns the entry name without a leading slash.

folder : string
target : string
Returns: string

Type something to start searching.