npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

excel-build

v1.1.2

Published

excel-build is a library for creating excel files in the browser

Downloads

155

Readme

excel-build

npm npm

Installation

npm install excel-build

Usage

FileBuilder

import { FileBuilder } from 'excel-build';

const excelFile = new FileBuilder('FILE_NAME');

excelFile.addSheet(sheet1).addSheet(sheet2).download();

API

| Method | Description | Type | Parameter | Returns | | :--------: | :----------------------------------: | :--------: | :------------: | :-----------: | | addSheet | Add a sheet to the Excel file. | function | SheetBuilder | FileBuilder | | download | Download the Excel file you created. | function | - | void |

SheetBuilder

import { SheetBuilder } from 'excel-build';

const data = [
  ['1', 'soohyun', '[email protected]', '01012345678', 'FE'],
  ['2', 'sasha', '[email protected]', '01087654321', 'BE'],
];

const sheet1 = new SheetBuilder('sheet_1');
const sheet2 = new SheetBuilder('sheet_2')
  .appendThead(['id', 'name', 'email', 'phone', 'department'])
  .appendTbody(data)
  .mergeCell([0, 3], [4, 3]);

API

| Method | Description | Type | Parameter | Returns | | :---------------: | :--------------------------------------------------------------------------------------: | :--------: | :----------------------------------------------------------: | :------------: | | appendThead | Adds a header row to the table. | function | (theadArr: string[], option: any) | SheetBuilder | | appendRow | Adds a row to the table. | function | (tRowArr: string\|number\|boolean\|Date[], option: any) | SheetBuilder | | appendTbody | Adds a row in array to the table. | function | (tbodyArr: string\|number\|boolean\|Date[][], option: any) | SheetBuilder | | appendCustomRow | Add custom style rows to the table. | function | (row: string\|number\|boolean\|Date[], option: any) | SheetBuilder | | mergeCell | Merge the cells with the starting cell [x0, y0] and the ending cell [x1, y1] as factors. | function | (start: [number, number], end: [number, number]) | SheetBuilder | | getWorkSheet | Returns the sheet you created. | function | - | SheetBuilder | | getSheetName | Returns the name of the sheet you created. | function | - | string | | setColumnWidth | Set the width for a specific column on the sheet. | function | (columnNumber: number, width: number) | SheetBuilder |

CellBuilder

const data = ['1', 'soohyun', '[email protected]', '01012345678', 'FE'];

sheet1.appendCustomRow(
  data.map((item) =>
    new CellBuilder(item)
      .setFontSize(20)
      .setFontColor('#FFFFFF')
      .setBackgroundColor('#555555')
      .setFontItalic()
      .build()
  )
);

API

| Method | Description | Type | Parameter | Returns | | :------------------------: | :-----------------------------------------------------------------: | :--------: | :---------------------------: | :-----------: | | setAlignMentVertical | Sets the vertical alignment of cells. | function | center | top | bottom | CellBuilder | | setAlignMentHorizontal | Sets the horizontal alignment of cells. | function | center | left | right | CellBuilder | | setAlignMentWrapText | Allow text wrapping. | function | - | CellBuilder | | setAlignMentTextRotation | 180 is rotated down 180 degrees, 255 is special, aligned vertically | function | 0 to 180, or 255 | CellBuilder | | setBorder | Sets the border style for cells. | function | null | BorderStyleType | CellBuilder | | setBackgroundColor | Sets the background color of the cell. | function | string(HEX) | CellBuilder | | setFontColor | Set the color of the font. | function | string(HEX) | CellBuilder | | setFontSize | Set the font size. | function | number | CellBuilder | | setFontBold | Set the font in bold. | function | - | CellBuilder | | setFontItalic | Set the font to italic. | function | - | CellBuilder | | setFontStrike | Set strikethrough in the font. | function | - | CellBuilder | | setFontUnderline | Underline the font. | function | - | CellBuilder | | build | Build a cell. | function | - | CellBuilder |

type BorderType =
  | 'dashDotDot'
  | 'dashDot'
  | 'dashed'
  | 'dotted'
  | 'hair'
  | 'mediumDashDotDot'
  | 'mediumDashDot'
  | 'mediumDashed'
  | 'medium'
  | 'slantDashDot'
  | 'thick'
  | 'thin';

type BorderStyleType = {
  top?: { style: BorderType; color: ColorType };
  bottom?: { style: BorderType; color: ColorType };
  left?: { style: BorderType; color: ColorType };
  right?: { style: BorderType; color: ColorType };
  diagonal?: {
    style: BorderType;
    color: ColorType;
    diagonalUp: boolean;
    diagonalDown: boolean;
  };
};
type ColorType = {
  rgb?: string;
  theme?: number;
  tint?: number;
};

🙏 Thanks

This project is a fork of SheetJS/sheetjs combined with code from sheetjs-style (by ShanaMaid) and sheetjs-style-v2 (by Raul Gonzalez) and xlsx-js-style (by gitbrent).

All projects are under the Apache 2.0 License