Skip to content

API Documentation

jokedst edited this page Sep 3, 2017 · 1 revision

API

NullXlsx

Minimal javascript library to create xlsx files

new NullXlsx(filename, options)

Creates a new xlsx file

Param Type Description
filename string Name of file once generated
options Object Settings

nullXlsx.addSheetFromData(data, name) ⇒ NullXlsx

Create a spreadsheet from an array of arrays of data

Returns: NullXlsx - Returns itself for method chaining

Param Type Description
data Array.<Array.<*>> Cell values
name string Name of sheet

nullXlsx.generate() ⇒ ArrayBuffer

Generates the xlsx file

Returns: ArrayBuffer - Array buffer containing the xlsx

nullXlsx.createDownloadUrl() ⇒ string

Creates an ObjectURL blob containing the generated xlsx

Returns: string - ObjectURL to xlsx

nullXlsx.createDownloadLink(linkText) ⇒ Element

Create download (or update existing)

Returns: Element - Link object

Param Type Description
linkText string | Element Existing link object or text to set on new link

NullZipArchive

A minimal non-compressing zip archive

new NullZipArchive(filename, [createFolderEntries])

Creates a new non-compressing zip archive

Param Type Description
filename string File names. Must be ASCII
[createFolderEntries] boolean If true a zip entry is made for each folder (subfolders should work without this)

nullZipArchive.addFileFromString(filename, content) ⇒ NullZipArchive

Add a text file to the archive, specifying the text

Returns: NullZipArchive - Returns itself for method chaining

Param Type Description
filename string File name, including directory path (e.g. subdir/text.txt)
content string File contents

nullZipArchive.addFileFromUint8Array(filename, binaryContent) ⇒ NullZipArchive

Add a file to the archive, using an array buffer as source data

Returns: NullZipArchive - Returns itself for method chaining

Param Type Description
filename string File name, including directory path (e.g. subdir/text.txt)
binaryContent Uint8Array Array buffer

nullZipArchive.generate() ⇒ ArrayBuffer

Generate a zip archive

Returns: ArrayBuffer - Array buffer containing the zip archive

nullZipArchive.createDownloadUrl() ⇒ string

Creates an ObjectURL blob containing the generated xlsx

Returns: string - ObjectURL to xlsx

nullZipArchive.createDownloadLink(linkText) ⇒ Element

Create download link object (or update existing)

Returns: Element - Link object

Param Type Description
linkText string | HTMLAnchorElement Existing link object or text to set on new link