Socket
Socket
Sign inDemoInstall

react-xlsx-wrapper

Package Overview
Dependencies
15
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-xlsx-wrapper

An important tool to make it easy to work with excel file formats. It supports lots of file formats as well. As this an wrapper around JS API for XLSX package. It does supports basic Cell styling as well as width based on characters. etc. Can be used in a


Version published
Weekly downloads
139
increased by13.93%
Maintainers
1
Install size
10.1 MB
Created
Weekly downloads
 

Changelog

Source

v2.6.0

  • Stable Version. Fixed Column Width bugs on xStep Parameter
  • Added New feature to handle auto filter support on the headers. Just add autoFilterForAllColumn to true.
  • Reduced the size of the package. Trying to improve more.

Readme

Source

React-XLSX-wrapper

npm version

A data export library built with and for React, Next.js

Note

Please don't use this package with [2.0.0 - 2.0.7] versions. It has major issues. Either Stick to 1.1.5 or move to 2.0.8 and so on.

Installation

With npm:

npm install --save react-xlsx-wrapper@latest
pnpm add react-xlsx-wrapper@latest
yarn add react-xlsx-wrapper@latest

Code Examples

Excel Props

PropTypeDefaultRequiredDescription
hideElementboolfalsefalseTo hide the button & directly download excel file
filenamestringDownloadfalseExcel file name to be downloaded
fileExtensionstringxlsxfalseDownload file extension [xlsx]
elementHTMLElement<button>falseElement to download excel file
childrenReact.ReactElement<ExcelSheetProps>nulltrueExcelSheet Represents data

ExcelSheet Props

PropTypeDefaultRequiredDescription
namestring""trueSheet name in file
bigHeading ExcelSheetColundefinedfalseBig Merged Cell Heading
autoFilterForAllColumnbooleanfalsefalseAuto Filter Generated Based on Colums
dataany[]nullfalseExcel Sheet data
dataSetExcelSheetData[]nullfalseExcel Sheet data
childrenExcelColumnnullfalseExcelColumns

Note: In ExcelSheet props dataSet has precedence over data and children props.

For further types and definitions Read More

Cell Style

Cell styles are specified by a style object that roughly parallels the OpenXML structure. The style object has five top-level attributes: fill, font, numFmt, alignment, and border.

Style AttributeSub AttributesValues
fillpatternType"solid" or "none"
fgColorCOLOR_SPEC
bgColorCOLOR_SPEC
fontname"Calibri" // default
sz11 // font size in points
colorCOLOR_SPEC
boldtrue or false
underlinetrue or false
italictrue or false
striketrue or false
outlinetrue or false
shadowtrue or false
vertAligntrue or false
numFmt"0" // integer index to built in formats, see StyleBuilder.SSF property
"0.00%" // string matching a built-in format, see StyleBuilder.SSF
"0.0%" // string specifying a custom format
"0.00%;\\(0.00%\\);\\-;@" // string specifying a custom format, escaping special characters
"m/dd/yy" // string a date format using Excel's format notation
alignmentvertical"bottom" or "center" or "top"
horizontal"bottom" or "center" or "top"
wrapTexttrue or false
readingOrder2 // for right-to-left
textRotationNumber from 0 to 180 or 255 (default is 0)
90 is rotated up 90 degrees
45 is rotated up 45 degrees
135 is rotated down 45 degrees
180 is rotated down 180 degrees
255 is special, aligned vertically
bordertop{ style: BORDER_STYLE, color: COLOR_SPEC }
bottom{ style: BORDER_STYLE, color: COLOR_SPEC }
left{ style: BORDER_STYLE, color: COLOR_SPEC }
right{ style: BORDER_STYLE, color: COLOR_SPEC }
diagonal{ style: BORDER_STYLE, color: COLOR_SPEC }
diagonalUptrue or false
diagonalDowntrue or false

COLOR_SPEC: Colors for fill, font, and border are specified as objects, either:

  • { auto: 1} specifying automatic values
  • { rgb: "FFFFAA00" } specifying a hex ARGB value
  • { theme: "1", tint: "-0.25"} specifying an integer index to a theme color and a tint value (default 0)
  • { indexed: 64} default value for fill.bgColor

BORDER_STYLE: Border style is a string value which may take on one of the following values:

  • thin
  • medium
  • thick
  • dotted
  • hair
  • dashed
  • mediumDashed
  • dashDot
  • mediumDashDot
  • dashDotDot
  • mediumDashDotDot
  • slantDashDot

Borders for merged areas are specified for each cell within the merged area. So to apply a box border to a merged area of 3x3 cells, border styles would need to be specified for eight different cells:

  • left borders for the three cells on the left,
  • right borders for the cells on the right
  • top borders for the cells on the top
  • bottom borders for the cells on the left

Keywords

FAQs

Last updated on 14 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc