Advertisement
vitareinforce

jspdf autotable

Jul 7th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. examples.long = function () {
  2. var doc = new jsPDF('l')
  3.  
  4. var head = headRows()
  5. head[0]['text'] = 'Text'
  6. var body = bodyRows(4)
  7. body.forEach(function (row) {
  8. row['text'] = faker.lorem.sentence(100)
  9. })
  10.  
  11. doc.text("Overflow 'ellipsize' with one column with long content", 14, 20)
  12. doc.autoTable({
  13. head: head,
  14. body: body,
  15. startY: 25,
  16. // Default for all columns
  17. styles: { overflow: 'ellipsize', cellWidth: 'wrap' },
  18. // Override the default above for the text column
  19. columnStyles: { text: { cellWidth: 'auto' } },
  20. })
  21. doc.text(
  22. "Overflow 'linebreak' (default) with one column with long content",
  23. 14,
  24. doc.lastAutoTable.finalY + 10
  25. )
  26. doc.autoTable({
  27. head: head,
  28. body: body,
  29. startY: doc.lastAutoTable.finalY + 15,
  30. rowPageBreak: 'auto',
  31. bodyStyles: { valign: 'top' },
  32. })
  33.  
  34. return doc
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement