All Projects → SheetJS → Ssf

SheetJS / Ssf

Licence: apache-2.0
📝 Spreadsheet Number Formatter

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ssf

is-primitive
Is the typeof value a javascript primitive?
Stars: ✭ 35 (-74.82%)
Mutual labels:  string, number
vue-translated
Internationalization (i18n) and localization (l10n) library for Vue.js v2.
Stars: ✭ 19 (-86.33%)
Mutual labels:  formatter, number
DataTypes
Built-in data types
Stars: ✭ 34 (-75.54%)
Mutual labels:  string, number
Number To Words
Number to string standalone PHP library with i18n. Drivers for numbers and currency included.
Stars: ✭ 234 (+68.35%)
Mutual labels:  string, number
rxjs-ninja
RxJS Operators for handling Observable strings, numbers, booleans and more
Stars: ✭ 68 (-51.08%)
Mutual labels:  string, number
prototyped.js
Some common Typescript prototypes
Stars: ✭ 22 (-84.17%)
Mutual labels:  string, number
DigitText
The module allows to translate numbers into a text equivalent. This is important in the billing.
Stars: ✭ 22 (-84.17%)
Mutual labels:  string, number
Translatedjs
Internationalization and localization for JavaScript and Node.js
Stars: ✭ 17 (-87.77%)
Mutual labels:  formatter, number
Fmt.jl
Python-style format strings for Julia
Stars: ✭ 31 (-77.7%)
Mutual labels:  formatter, string
react-numeric
A react component for formatted number form fields
Stars: ✭ 30 (-78.42%)
Mutual labels:  formatter, number
kirai
String formatting library for Java, Android, Web and Unix Terminal
Stars: ✭ 69 (-50.36%)
Mutual labels:  formatter, string
Javascript Number Formatter
Lightweight & Fast JavaScript Number Formatter
Stars: ✭ 119 (-14.39%)
Mutual labels:  formatter, number
Croc
Swift emoji string parsing library
Stars: ✭ 124 (-10.79%)
Mutual labels:  string
Lua Fmt
lua-fmt is pretty-printer for Lua code
Stars: ✭ 132 (-5.04%)
Mutual labels:  formatter
Editorconfig Netbeans
A NetBeans IDE plugin supporting the EditorConfig standard. ⛺
Stars: ✭ 123 (-11.51%)
Mutual labels:  formatter
Auto Correct
Automatically add whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).
Stars: ✭ 122 (-12.23%)
Mutual labels:  formatter
Validatetor
Android library for fast and simple string validation
Stars: ✭ 136 (-2.16%)
Mutual labels:  string
Xlsx
Fast and reliable way to work with Microsoft Excel™ [xlsx] files in Golang
Stars: ✭ 132 (-5.04%)
Mutual labels:  spreadsheet
Gsheets Db Api
A Python DB-API and SQLAlchemy dialect to Google Spreasheets
Stars: ✭ 122 (-12.23%)
Mutual labels:  spreadsheet
Bee.js
javaScript常用工具类
Stars: ✭ 130 (-6.47%)
Mutual labels:  string

SheetJS SSF

ssf (SpreadSheet Format) is a pure JS library to format data using ECMA-376 spreadsheet format codes (used in popular spreadsheet software packages).

This is the community version. We also offer a pro version with additional features like international support as well as dedicated support.

Installation

With npm:

$ npm install ssf

In the browser:

<script src="ssf.js"></script>

The browser exposes a variable SSF

When installed globally, npm installs a script ssf that renders the format string with the given arguments. Running the script with -h displays help.

The script will manipulate module.exports if available . This is not always desirable. To prevent the behavior, define DO_NOT_EXPORT_SSF.

Usage

SSF.format(fmt, val, opts) formats val using the format fmt.

If fmt is a string, it will be parsed and evaluated. If fmt is a number, the actual format will be the corresponding entry in the internal format table. For a raw numeric format like 000, the value should be passed as a string.

Date arguments are interpreted in the local time of the JS client.

The options argument may contain the following keys:

Option Name Default Description
date1904 false Use 1904 date system if true, 1900 system if false

Manipulating the Internal Format Table

Binary spreadsheet formats store cell formats in a table and reference by index. This library uses a global table:

SSF._table is the underlying object, mapping numeric keys to format strings.

SSF.load(fmt:string, idx:?number):number assigns the format to the specified index and returns the index. If the index is not specified, SSF will search the space for an available format slot pick an unused slot. For compatibility with the XLS and XLSB file formats, custom indices should be in the valid ranges 5-8, 23-26, 41-44, 63-66, 164-382 (see [MS-XLSB] 2.4.655 BrtFmt)

SSF.get_table() gets the internal format table (number to format mapping).

SSF.load_table(table) sets the internal format table.

Other Utilities

SSF.parse_date_code(val:number, opts:?any) parses val, returning an object:

type SSFDate = {
  D:number; /* number of whole days since relevant epoch, 0 <= D */
  y:number; /* integral year portion, epoch_year <= y */
  m:number; /* integral month portion, 1 <= m <= 12 */
  d:number; /* integral day portion, subject to gregorian YMD constraints */
  q:number; /* integral day of week (0=Sunday .. 6=Saturday) 0 <= q <= 6 */

  T:number; /* number of seconds since midnight, 0 <= T < 86400 */
  H:number; /* integral number of hours since midnight, 0 <= H < 24 */
  M:number; /* integral number of minutes since the last hour, 0 <= M < 60 */
  S:number; /* integral number of seconds since the last minute, 0 <= S < 60 */
  u:number; /* sub-second part of time, 0 <= u < 1 */
}

SSF.is_date(fmt:string):boolean returns true if fmt encodes a date format.

Examples

Related Packages

ssf-cli is a simple NodeJS command line tool for formatting numbers.

License

Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 license are reserved by the Original Author.

References

  • ECMA-376: Office Open XML File Formats
  • MS-XLS: Excel Binary File Format (.xls) Structure Specification
  • MS-XLSB: Excel (.xlsb) Binary File Format

Badges

Sauce Test Status

Build Status

Coverage Status

NPM Downloads

Dependencies Status

Analytics

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].