Git Product home page Git Product logo

xlsx-preview's Introduction

XlsxPreview

Preview the .xlsx in the browser, convert to HTML with styles. The dependencies of this package is exceljs, it build the pretty preview by exceljs. And it can run in a Worker.

Demo

Jump to the demo page

Installation

  npm install xlsx-preview

or

  yarn add xlsx-preview

Importing

CommonJS

  const xlsxPreview = require('xlsx-preview');

ESModule

  import xlsxPreview from 'xlsx-preview';

Browserify

Before import xlsxPreview.js on browser, you need import excel.js first.

  <script src="exceljs.js"></script>
  <script src="xlsxPreview.js"></script>

Usage

  // ...
  const result = await xlsxPreview.xlsx2Html(data, options);

See data See options

data

The data can be one of the types, ArrayBuffer, Blob, or File.

options

The options is optional.

  export interface XlsxOptions {
    output?: "string" | "arrayBuffer";
    separateSheets: boolean;
    minimumRows: number;
    minimumCols: number;
  }
  • options.output: default "string", set the output format, string or ArrayBuffer.
  • separateSheets: default false, whether the worksheets needs to be separated.
    • If separateSheets: true, the result will be an Array.
  • minimumRows: default 20, Regardless of whether the worksheet has enough rows, the minimum number of rows generated.
  • minimumCols: default 16, Regardless of whether the worksheet has enough cols, the minimum number of cols generated.

xlsx-preview's People

Contributors

simon5057 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xlsx-preview's Issues

Issue can be deleted

I edited this issue to remove cryptocurrency adspam. My account was used by a bad actor because of a leaked access token. This bad actor created lots of issues with cryptocurrency adspam. I am sorry. Sadly I can only update issues, not delete them.

大文件

文件大小有限制么,如果100兆的xlsx可以预览吗?

在Firefox里的height问题

在Firefox里表格高度没有100%,请修改一下src\CSSStyles\base.ts 第35行
.${EXCEL_SHEETS_CLS} { position: relative; } 改成 .${EXCEL_SHEETS_CLS} { height:100%; position: relative; }

Issue can be deleted

I edited this issue to remove cryptocurrency adspam. My account was used by a bad actor because of a leaked access token. This bad actor created lots of issues with cryptocurrency adspam. I am sorry. Sadly I can only update issues, not delete them.

Can not use

ExcelJS in ./node_modules/xlsx-preview/dist/xlsxPreview.umd.js

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.