Git Product home page Git Product logo

tableexport.jquery.plugin's Introduction

tableExport.jquery.plugin

Export HTML Table to

  • JSON
  • XML
  • PNG
  • CSV
  • TXT
  • SQL
  • MS-Word
  • Ms-Excel
  • Ms-Powerpoint
  • PDF

Installation

jquery Plugin
<script type="text/javascript" src="tableExport.js">
<script type="text/javascript" src="jquery.base64.js">

PNG Export

<script type="text/javascript" src="html2canvas.js">

PDF Export

<script type="text/javascript" src="jspdf/libs/sprintf.js">
<script type="text/javascript" src="jspdf/jspdf.js">
<script type="text/javascript" src="jspdf/libs/base64.js">

Usage

onClick ="$('#tableID').tableExport({type:'pdf',escape:'false'});"

Options

separator: ','
ignoreColumn: [2,3],
tableName:'yourTableName'
type:'csv'
pdfFontSize:14
pdfLeftMargin:20
escape:'true'
htmlContent:'false'
consoleLog:'false'

tableexport.jquery.plugin's People

Contributors

kayalshri avatar

Stargazers

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

Watchers

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

tableexport.jquery.plugin's Issues

[Solved] Wrong mime type word files and filename dialog

Hi,

I was trying to export xls and doc, but fails filename and fails extension, here is the solution 💊

💻 Current line (line 279):
window.open('data:application/vnd.ms-'+defaults.type+';filename=exportData.doc;' + base64data);

Replace the current line with:
powerful new lines:

var anchor = document.createElement('a');//Create an anchor element
document.body.appendChild(anchor); //Add it to document
anchor.href = 'data:application/vnd.ms' + (defaults.type === 'doc' ? 'word' : '-' + defaults.type) + ';filename=exportData.doc;' + base64data; //Create content and mime type
anchor.download = 'exportData.' + (defaults.type === 'excel' ? 'xls' : (defaults.type === 'powerpoint' ? 'ppt' : defaults.type)); //Custom filename+ext (ext fix)                  
anchor.click();//Launch

Office MIME Types:

✅ Tested on: Chrome, Firefox.
(Sorry IE).

😬

Output sometimes appears in the same browser window.

Hello, nice work on this plugin. I noticed that some of the output types, like PDF for instance, appear within the same browser window. This can be confusing to some users who do not realize they need to hit the back button to get back to the page. They may close the window instead.

Could you modify the plugin so the output always appears in a new browser window?

Can't Get Plugin to Work

Can someone please post a fiddle or an example of how to call in the approach files, initialize and export a table to PDF on a button press? I think either I called in the wrong files or I'm failing to understand how to properly initialize the plugin. Thanks.

Update (Resolved): I was able to resolve my issue once I found this link with examples.
http://ngiriraj.com/pages/htmltable_export/demo.php

ignoreColumn & ignoreRow does not work correctly with colspan & rowspan

I have a table that uses rowspan & colspan. When i try to use the ignoreColumn & ignoreRow then dont work correctly with it. Also both rowspan & colspan uses indexes to ignore , it would be nice to have also a possibility of doing it with a class name . This can help ignore rows / columns dynamically.

How to export datatable with huge rows to excel file ?

Dear,
I have a dataTable with 3288 rows, the export to excel is ok with dataTable arround 1000 rows but when the number of rows too many, it can't export to excel.
Please help me is there anyway to fix it?
Thank you.

Worksheet name when exporting excel type

Is there any way to change my default's worksheet when exporting an excel type using this plugin?
The default name is: 'xlsWorksheetName'.
In code, I already set up its tableName but it does not change worksheet name.

Thanks in advance

Install

Hi and Thanks to your action
I add all js to my php file.
1- Please tell me how add those to jquery Plugin?

<script type="text/javascript" src="tableExport.js"> <script type="text/javascript" src="jquery.base64.js"> And my table in mysql database is "result". 2-I must change "customer " to "result"?
  • XML
  • Need option for fileName to be saved

    When i download the file the file name is in encoded form. I dont want it to be encoded. I need to enter the filename manually or during intialisation

    csv files and xcel file issues

    When exporting as a csv the file format .csv isn't appended to the downloaded file.

    When opening the excel file downloaded in office 2013 I get the following message:

    The file format and extension of download.xls don't match. the file could be corrupted or unsafe.

    also is would great to have an option to name the downloaded files. So for example you could have 'mydata-10-09-2014.csv'

    Issue with exporting

    Hi,

    I am using this extension and I have some questions:

    1. Why does csv not save as .csv?
    • I have to rename the file and add .csv
    • same with txt, sql, and word

    Also when choosing to export as PDF it looks like this:
    pdfgrid

    Table Export.Js Is Not Working In Internet Explorer Version 10

    Hi team,

    I was working with custom page. In my application i have a table with data and i need to export the data in to an excel sheet. I used the same code which is given in this site. Its working very fine in Chrome browser. But its not at all working in Internet Explorer. Can anyone tell me what we need to change it in the plugin.

    Thanks
    Nagarajan
    9841766690****

    Install

    Hi and Thanks to your action
    I add all js to fist of my php file.
    1- Please tell me i must add blow js to jquery Plugin?
    "tableExport.js" and "jquery.base64.js" if Yes how?
    Also my table in mysql database is "result".
    2-I must change "customer " to "result" in php code?

    Lately,I have met a problem that 。。。。。

    when I use exceldownload,the Firefox explorer seems to have some characters problems.It shows that "you are openning ....+PC9yenieYLLm+8mdejUUMSTW+...",rather than "you are openning the file named download'",could anyone help with my problem?

    Data in PDF file

    I try to export file

    i add this

    <a  href="#"   onclick="$('#tabledata').tableExport({ type: 'excel', escape: 'false' });" style="background-color: #3399FF; color: #FFFFFF; font-weight: bold; font-size: medium">XLS</a>
    
    <a  href="#"   onclick="$('#tabledata').tableExport({ type: 'pdf', escape: 'false' });"  style="background-color: #3399FF; color: #FFFFFF; font-weight: bold; font-size: medium">PDF</a>
    

    now the problem i have 6columns in table but pdf display only 4 columns

    check image
    http://i.stack.imgur.com/r4Etu.png

    This plugin cannot work with Internet Explorer

    Hi, I tried using this plugin to export datatable to excel. It works fine with chrome but not with Internet Explorer. Any work around or a settings that could help? Please suggest. Thanks!!

    any support to ignore rows?

    I notice that in options there is a ignoreColumn propertie is there anything to ignore a row?

    Btw Awesome plugin!

    Text options do not include CRLF

    When the text options are used (like CSV), and the output is opened in notepad, carriage returns and line feeds CRLF are not included at the end of data rows. This may cause complications for applications that consume the output as they may require CRLF to denote when a particular data line ends.

    Exporting the background colors

    I am thinking about using this plug in on my web table. I have a html table and some cells have background colors. When I import the data to the excel, will those cell colors be imported as well? Thanks

    Export To Excel

    Hi good evening, i make a change when export to excel, is better make a Blob object :)

    var ext = "doc";
    if(defaults.type == "excel"){
    ext = ".xls";
    }

    var blob = new Blob([excelFile], { type: 'text/plain' });
    var a = document.createElement('a');
    a.href = window.URL.createObjectURL(blob);
    a.download = defaults.tableName + ext;
    a.click();

    //window.open('data:application/vnd.ms-'+defaults.type+';filename=otro.doc;' + base64data);

    Save export do server?

    Hello, I have to save the export directly into a folder on the server and then pass a URL to the user? My user wants not download directly

    xlsx extension

    The extension of the excel export is xls, which is rather outdated.
    Does this mean the format is actually oldschool pre-2007 xls, or does it use xlsx behind the scenes?

    And if not, could that become an option?

    extension not working

    I've installed the show-export plug-in for the table, followed the installation guide, added the scripts etc. then added the code for the table.. but it doesn't show. It's completely stumped me, so I reninstalled with the aid of a friend and still no luck!

    The code for my table:

    <table 
    data-toggle="table" 
    data-url="/assets/ajax/get-export-docs.php" 
    data-show-columns="true"
    data-search="false" 
    data-show-refresh="true"
    data-show-toogle="true"
    data-show-export="true"
    data-side-pagination="server"
    data-pagination="true" 
    data-page-list="[5, 10, 20, 50, 100, 200]" 
    data-query-params="queryParams"  
    data-toolbar="#filter-bar"
    data-show-filter="true"
    data-height="500" id="export-table">
    

    my script code:

    <!-- Show export plug in -->
    <script src="/assets/plugins/tableExport-jquery-plugin/tablExport.jquery.json"></script>
    <script type="text/javascript" src="/assets/plugins/tableExport-jquery-plugin/tableExport.js"></script>
    <script type="text/javascript" src="/assets/plugins/tableExport-jquery-plugin/jquery.base64.js"></script>
    <script type="text/javascript" src="html2canvas.js"></script>
    <script type="text/javascript" src="jspdf/libs/sprintf.js"></script>
    <script type="text/javascript" src="jspdf/jspdf.js"></script>
    <script type="text/javascript" src="jspdf/libs/base64.js"></script>
    

    is there something wrong? I've also checked firebug and clicked the script links to see if that was the reason but they go to that document.

    Extra Table Being Rendered, top row not being rendered correctly

    Is anyone else getting this sort of error? I don't know if this is an issue with jsPDF, jsPDF autotable, or this library.

    I have attached my table, the function call, and the restulting pdf.

    ethnnoyesTotals
    noyesnoyes
    black2431317456504
    hisp2859020996680
    other1,3603371,1253543,176
    Totals1,8885581,4085064,360

    <a href="#" onclick="$('.pvtTable').tableExport( {type: 'pdf',jspdf: {format: 'bestfit', autotable: {tableWidth: 'wrap'}}});">PDF</a>

    tableExport(2).pdf

    Bower Install

    What is the package name of this plugin? i need to do: bower install tableExport.jquery.plugin

    Error on consol

    Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    /js/tableExport.js Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

    Export to excel with colspan and rowspan

    Hello,

    I have a little disagrement with my table structure : colspans and rowspans are not 'translate' from Html to Excel causing shifts in the exported file :/

    any idea to solve that ?

    Internet Explorer is not supported

    This may be beyond the capabilities of JavaScript but I thought I would ask anyway.

    This plugin does not work in Internet Explorer because I believe it sends the output as a data URI (http://en.wikipedia.org/wiki/Data_URI_scheme).

    From what I read here (http://www.jquerybyexample.net/2012/10/export-table-data-to-excel-using-jquery.html ), IE requires a response header. Is it possible to generate a header on the client side in some way so this plugin works for IE? There is a solution here (http://www.jquerybyexample.net/2014/04/export-table-to-excel-jquery-ie.html ) but is a server side solution.

    Maybe a post in the links above could provide a workable client side solution? A reply from David Rainsford here (http://stackoverflow.com/questions/393647/response-content-type-as-csv ) looks interesting.

    CN is Not supported?

    wheni export a table with chinese,the plugin throw this exception:
    "uncaught exception: INVALID_CHARACTER_ERR: DOM Exception 5"

    Add text before table

    Hello i would like to add some text before table and a title in my PDF but i don't know how i can make it.
    There is my code

    $('#table_div').bootstrapTable({
            exportOptions : {
                fileName : 'liste_deduction_patro',
                worksheetName : 'deductions_patro',
                jspdf : {
                    orientation : 'l',
                    autotable: {styles: {cellPadding: 2,
                                         rowHeight: 12,
                                         fontSize: 8,
                                         fillColor: 255,       
                                         textColor: 50,         
                                         fontStyle: 'normal',   
                                         overflow: 'ellipsize', 
                                         halign: 'left',        
                                         valign: 'middle'      
                                        },
                                headerStyles: {fillColor: [52, 73, 94],
                                               textColor: 255,
                                               fontStyle: 'bold',
                                               halign: 'center'
                                              },
                                alternateRowStyles: {fillColor: 245
                                                    },
                                                    createdHeaderCell: function (cell, data) {},
                                tableExport: {onAfterAutotable: null,
                                              onBeforeAutotable:null,
                                              onTable: null
                                             }
                               }
                },
                ignoreColumn : [0]
            }
        });
    

    No support for tables using rowspan

    If the HTML contains cells using rowspan then the table is not exported properly. Can support be added to accommodate the use of rowspan?

    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.