jsPDF с autoTable: как поместить верхнюю границу строки или ячеек в строке - PullRequest
0 голосов
/ 09 октября 2019

Есть ли способ поместить верхнюю границу в ячейку или строку с помощью jsPDF autoTable? Я устал укладывать его. В последнее время я пытался добавить строки перед строкой, я хотел сделать границу и сделать эту строку черной, но я не могу контролировать ее последовательно.

var doc = new jsPDF('l', 'mm', 'a4');
    var img = new Image()
    img.src = server +'assets/images/dashboard/img.jpeg';
    doc.addImage(img, 'jpeg', 15, 5, 116, 22);
    doc.fromHTML(document.getElementById('acctInfoRow'),15,30);
    doc.setFontSize(9);
    doc.text($('#main_div #overview_header .timeStamp').text(),15,58);
    $('#print_this #printTable_0 .total_row, #print_this #printTable_0 .sub_total_row').before('<tr class="total_border"><td colspan="15"></td></tr>');
    doc.autoTable({
        html: '#printTable_0',
        startY: 60,
        rowPageBreak: 'avoid',
        didParseCell: function(data) {
            if ($(data.row.raw).hasClass('datatable-group') && data.cell) {
                data.cell.styles.fillColor = 225;
            }
            if (($(data.row.raw).hasClass('topHeader2') && data.cell) || ($(data.row.raw).hasClass('topHeader') && data.cell)) {
                data.cell.styles.fillColor = 99;
            }
            if (($(data.row.raw).hasClass('sub_total_row') || $(data.row.raw).hasClass('total_row')) && data.cell) {
                data.cell.styles.minCellHeight = 20;
                data.cell.styles.valign = 'top';
                data.cell.styles.fillColor = 255;
            }
            if ($(data.row.raw).hasClass('total_border')  && data.cell) {
                data.cell.styles.fillColor = 1;
            }
        },
        willDrawCell: function(data) {
            if ($(data.row.raw).hasClass('datatable-group') && data.cell) {
                doc.setTextColor(25);
                doc.setFontStyle('bold');
            }
            if (($(data.row.raw).hasClass('sub_total_row') || $(data.row.raw).hasClass('total_row')) && data.cell) {
                doc.setTextColor(25);
                doc.setFontStyle('bold');
            }
        },
        didDrawCell: function(data) {
            if ($(data.row.raw).hasClass('total_border')  && data.cell) {
        data.row.height = .15
            }
        }
    });
var blob = doc.output("blob");
window.open(URL.createObjectURL(blob));
...