Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    const doc = new jsPDF();
                    doc.text(7, 15, "Daftar SP2D dengan Status Sudah Cair");
                    doc.autoTable(this.getColumns(), datacair, {
                        startY: 20,
                        margin: { horizontal: 7 },
                        styles: { columnWidth: 'wrap' },
                        columnStyles: {
                            text: { columnWidth: 'auto' },
                            nil: { halign: 'right' },
                            tgl: { halign: 'right' }
                        headerStyles: { halign: 'center' },
                        theme: 'grid'
                    doc.text("Daftar SP2D dengan Status Proses Pencairan", 7, doc.autoTable.previous.finalY + 10);
    its typescript on angular
    try to add
    overflow: 'linebreak',
    Mahesh Ruparel
    With jsPDF-AutoTable, we can give custom styling to a specific column, but how can I give custom styling to header column of that specific column ? Is it possible ?
    I can use this in node js?
    Josef Unger
    Hej, i got the following question, how can i achieve, that the linebreak in my body does not break in the words but after complete words? So that it is not breaking "Hello World" to "Hell" in one line and the next line "o World"? Thanks for your help guys! :)
    Hi i am using jspdf-autotable in my project. I don't know how to use colspan and rowspan in head section. I tried but it's not working properly for me.
    Hi I am using jspdf-auto table. I have used it to generate table from mysql. The table has dates in first column which are displayed properly in the results in dev tools console but in the generated pdf it shows only years and those are also from 1990 to 2015, though i have data for only last two months. Dates have apparently been converted to years in some weird way. I have tried looking for it but it seems no one ever faced this problem before this.
    Hello all, hopefully, someone can help. I'm using autotable to generate a pdf with a table that has styling applied to it through css. How do I persist that css to the autotable plugin?
    I am new to the angular. Trying to add the header and footer in the Autotable . Anyone help me to add the header image and footer pagenumber. I saw the above email but i dont which code new to apply
    Amina Mahmoud
    hii i'm trying to write arabic data in pdf using jspdf auto table how to do it ?
    Hi Simon, Thanks for the plugin, it works great with limited number of columns.
    Is there any way to overflow columns to next page after some number of columns? For example i have 15 columns and i want to show first 10 columns in first page and then remaining 5 columns in next page. If the rows are more than page size then the next set of rows should split in 3rd and 4th page and continues on.

    how to change a background color of a row which contain a specific word please help i am beginner //alert("hai");
    var enhance = true;
    var currentRow;
    tableWidth: '160',
    margin: {horizontal: 7},
    bodyStyles: {valign: 'top'},
    styles: {cellWidth: 'auto', overflow: 'linebreak',fillColor:[208,223,241]},
    columnWidth: 'auto',
    // showHeader: 'firstPage',
    font: "sans-serif",
    fontStyle: 'bold',
    headerStyles: {fillColor: [147,87,176],fontSize: 10, textColor: [249,249,249]}, // Purple
    margin: {top: 40},
    didParseCell: enhance ? enhanceWordBreak : null,

            addPageContent: function(data) 
                // FOOTER
                var str = "Page " + doc.page;
                if (typeof doc.putTotalPages === 'function') {
                                        str = str + " of " + totalPagesExp;
                var xOffset = (doc.internal.pageSize.width); 
                else if(y=="p")
                                doc.text('Printed Date: '+today, 45,120);
                doc.page ++;
        var res = doc.autoTableHtmlToJson(document.getElementById(m));
                var clength=res.columns.length;
                var fsize;
                else  if(clength>10) 
                else  if(clength>7) 
                else  if(clength<6) 
              //  console.log("res.columns:", res.columns, "res.data:", res.data, res);
                doc.autoTable(res.columns, res.data, {margin: {top: vy+25},pageBreak: 'auto',styles: {cellPadding: 1.5,fontSize:fsize , },fontStyle: 'bold',drawRow: function (row, data) {
                currentRow = row;
                        currentRow.height =30;
                        var test1=String(currentRow.cells[1].raw);
                        if (test1 == "undefined")
                                  /* count++;
                                      for(var i=0;i<res.columns.length;i++)
                                         currentRow.cells[i].styles.fillColor = [255,227,185];
                                        for(var i=0;i<res.columns.length;i++)
                                            currentRow.cells[i].styles.fillColor = [255,193,160];
                if((currentRow.cells[0].text[0].includes('Total')) || (currentRow.cells[0].text[0].includes('Average of'))||(currentRow.cells[0].text[0].includes('Minimum of'))||(currentRow.cells[0].text[0].includes('Maximum of'))||(currentRow.cells[0].text[0].includes('Count of')))
                        for(var i=0;i<res.columns.length;i++)
                                doc.setTextColor(0, 0, 0);
                                doc.rect(data.settings.margin.left, row.y, data.table.width, row.height, 'F');
                                var dataval = ($.trim(currentRow.cells[0].raw.innerText).replace(/,/g, " "));

    //console.log("current text in if part ie sum of etc dataval: ", dataval, row.max

    @simonbengtsson please help

    here currentRow is row which given in auto table

    var res1 = doc.autoTableHtmlToJson(document.getElementById(m));
    var idmm=document.getElementById(n);

            var clength=res1.columns.length;
             var crow=res1.rows.length;
     doc.autoTable(res1.columns, res1.data, {margin: {top: vy+25},pageBreak: 'auto',styles: {cellPadding: 1.5,fontSize:fsize , },fontStyle: 'bold',drawRow: function (row, data) {
            currentRow1 = row;
                    currentRow1.height =30;

    if((currentRow1.cells[0].text[0].includes('Total')) || (currentRow1.cells[0].text[0].includes('Avg'))||(currentRow1.cells[0].text[0].includes('count'))||(currentRow1.cells[0].text[0].includes('Min'))||(currentRow1.cells[0].text[0].includes('Max')))

    { 1 for(var i=0;i<res1.columns.length;i++) {

                              currentRow1.cells[i].styles.fontStyle = "bold";
                              currentRow1.cells[i].styles.font = "sans-serif" ; 
                              currentRow1.cells[i].styles.fillColor = [243,205,204];                 


    },columnStyles: {0: {columnWidth: columnwidthrgroup},},});

    got it
    i just take all cell in that row thats easy
    how to do row grouping with out group last 4 rows which shows total max avg but in my code group entire table include these rows .please help how to group only my datatable rows ?
    Hi Simon, Is it possible to add bold and normal text in single cell using autotable?
    Mahmoud Alaskalany

    hi people
    i have used jspdf to create table with dynamic columns

    some rows are split on 2 pages

    how to set page limit for this or how to solve it

    Ankit Jaishwal
    Hey, Can anyone tell me how can change style of a column depending upon the value of another column of the same row?
    Ivyrose Ruiz
    Hi Simon, It is possible to add progresss/status bar in jspdf autotable ?
    Help me please, is it possible to remove this white space in the picture?
    Hashim Sayyid
    hi guys.
    Wondering if the didDrawPage function can allow html content for the header, so I can pass some html formatted text in stead of image/ normal text. Is that even possible?
    Been doing the doc.html(HTMLElement) func but this needs you to handle the callback to get the pdf with the html, and it also only displays on the first page.
    Hello, is this chat room active?
    Well, in any case, I was wondering if there is a good way to set columnwidth as percentage.
    @stvinz: You cannot specify the column width in percentage, but you should be able to calculate it yourself with the help of the page width