Skip to content
프로젝트

rainabba/jquery-table2excel

GitHub에서 보기

소개

HTML 테이블을 Excel 스프레드시트 호환 파일로 내보내는 jQuery 플러그인

생산성 및 자동화

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

jQuery table2excel Plugin (https://github.com/rainabba/jquery-table2excel)

#Credit for the core table export code concept goes to insin (met on Freenode in #javascript) and core code inspired from https://gist.github.com/insin/1031969

FIRST!!

Thanks for your interest. I haven't been able to maintain this and found the following project which looks well ahead of this one, so you may want to consider it first: TableExport

DISCLAIMER

This plugin is a hack on a hack. The .xls extension is the only way [some versions] of excel will even open it, and you will get a warning about the contents which can be ignored. The plugin was developed against Chrome and other have contributed code that should allow it to work in Firefox and Safari, but inconsistently since it's a hack that's not well supported anywhere but Chrome. I would not use this in public production personally and it was developed for an Intranet application where users are on Chrome and had known versions of Excel installed and the users were educated about the warning. These users also save-as in Excel so that when the files are distributed, the end-users don't get the warning message.

Install - Bower

Install bower globally

npm install -g bower

Install jquery-table2excel and dependencies

bower install jquery-table2excel --save

Include jquery and table2excel in your page

<script src="bower_components\jquery\dist\jquery.min.js"></script>
<script src="bower_components\jquery-table2excel\dist\jquery.table2excel.min.js"></script>

Install - Legacy

Include jQuery and table2excel plugin:

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="//cdn.rawgit.com/rainabba/jquery-table2excel/1.1.0/dist/jquery.table2excel.min.js"></script>

Using the plugin

Basic Usage (Legacy XLS Format)

$("#yourHtmlTable").table2excel({
    exclude: ".excludeThisClass",
    name: "Worksheet Name",
    filename: "SomeFile.xls", // do include extension
    preserveColors: false // set to true if you want background colors and font colors preserved
});

NEW: XLSX Export with Borders

$("#yourHtmlTable").table2excel({
    exclude: ".excludeThisClass",
    name: "Worksheet Name",
    filename: "SomeFile.xlsx",
    borders: true // Enable borders - automatically exports to XLSX format
});

Available Options

  • exclude (string, default: ".noExl"): CSS selector for elements to exclude from export
  • name (string, default: "Table2Excel"): Name of the Excel worksheet
  • filename (string, default: "table2excel"): Name of the downloaded file
  • fileext (string, default: ".xls"): File extension (.xls or .xlsx)
  • exclude_img (boolean, default: true): Exclude images from export
  • exclude_links (boolean, default: true): Exclude links from export
  • exclude_inputs (boolean, default: true): Exclude input elements from export
  • preserveColors (boolean, default: false): Preserve background and text colors (XLS only)
  • borders (boolean, default: false): Add borders to all cells (forces XLSX format)
  • excelFormat (string, default: "xls"): Choose between "xls" or "xlsx" format

Note: The borders option requires the JSZip library to be loaded on the page. Include it before the table2excel plugin:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="jquery.table2excel.js"></script>

demo/

Contains a simple HTML file to demonstrate your plugin.

dist/

This is where the generated files are stored once Grunt runs.

.editorconfig

This file is for unifying the coding style for different editors and IDEs.

Check editorconfig.org if you haven't heard about this project yet.

.jshintrc

List of rules used by JSHint to detect errors and potential problems in JavaScript.

Check jshint.com if you haven't heard about this project yet.

.travis.yml

Definitions for continous integration using Travis.

Check travis-ci.org if you haven't heard about this project yet.

table2excel.jquery.json

Package manifest file used to publish plugins in jQuery Plugin Registry.

Check this Package Manifest Guide for more details.

Gruntfile.js

Contains all automated tasks using Grunt.

Check gruntjs.com if you haven't heard about this project yet.

package.json

Specify all dependencies loaded via Node.JS.

Check NPM for more details.

Contributing

Check CONTRIBUTING.md

History

Check Release list.

License

MIT License

관련 프로젝트 살펴보기

불러오는 중…