Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. I am using javascript to convert a large table to a pdf

I am using javascript to convert a large table to a pdf

Scheduled Pinned Locked Moved JavaScript
javajavascripthtmlcsscollaboration
3 Posts 3 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zahira CHOUIBA
    wrote on last edited by
    #1

    Hi everyone, I wrote this great script to help my team set up the weekly task distribution board, I wrote it using java script, html, and css, they've been doing it for a very long time in pencil on paper. but now i am in the final stage, i would like to convert my table to pdf, and this is where i found it difficult, i did several tests : like convert csv to pdf, it doesn't always give a good table, as it is under html. I would like to add a column at the end of the table for remarks but I think I will try with it later. now i'm just focus on pdf export. to be able to print our table every week and hang it, instead of pencil and a paper.

    Export CSVExport PDF

    const timetable = document.getElementById("timetable");

    const days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
    const hours = ["7H", "13H", "20H"];

    // Create table headers for days
    const daysHeaderRow = document.createElement("tr");
    const daysHeaderCell = document.createElement("th");
    daysHeaderCell.innerHTML = "Days";
    daysHeaderRow.appendChild(daysHeaderCell);
    days.forEach(day => {
    const dayHeaderCell = document.createElement("th");
    dayHeaderCell.innerHTML = day;
    dayHeaderCell.colSpan = 3;
    daysHeaderRow.appendChild(dayHeaderCell);
    });
    timetable.appendChild(daysHeaderRow);

    // Create table headers for hours
    const hoursHeaderRow = document.createElement("tr");
    const hoursHeaderCell = document.createElement("th");
    hoursHeaderCell.innerHTML = "Hours";
    hoursHeaderRow.appendChild(hoursHeaderCell);
    for (let i = 0; i < days.length; i++) {
    for (let j = 0; j < 3; j++) {
    const hourHeaderCell = document.c

    J R 2 Replies Last reply
    0
    • Z Zahira CHOUIBA

      Hi everyone, I wrote this great script to help my team set up the weekly task distribution board, I wrote it using java script, html, and css, they've been doing it for a very long time in pencil on paper. but now i am in the final stage, i would like to convert my table to pdf, and this is where i found it difficult, i did several tests : like convert csv to pdf, it doesn't always give a good table, as it is under html. I would like to add a column at the end of the table for remarks but I think I will try with it later. now i'm just focus on pdf export. to be able to print our table every week and hang it, instead of pencil and a paper.

      Export CSVExport PDF

      const timetable = document.getElementById("timetable");

      const days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
      const hours = ["7H", "13H", "20H"];

      // Create table headers for days
      const daysHeaderRow = document.createElement("tr");
      const daysHeaderCell = document.createElement("th");
      daysHeaderCell.innerHTML = "Days";
      daysHeaderRow.appendChild(daysHeaderCell);
      days.forEach(day => {
      const dayHeaderCell = document.createElement("th");
      dayHeaderCell.innerHTML = day;
      dayHeaderCell.colSpan = 3;
      daysHeaderRow.appendChild(dayHeaderCell);
      });
      timetable.appendChild(daysHeaderRow);

      // Create table headers for hours
      const hoursHeaderRow = document.createElement("tr");
      const hoursHeaderCell = document.createElement("th");
      hoursHeaderCell.innerHTML = "Hours";
      hoursHeaderRow.appendChild(hoursHeaderCell);
      for (let i = 0; i < days.length; i++) {
      for (let j = 0; j < 3; j++) {
      const hourHeaderCell = document.c

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #2

      Congrats? :confused:

      Jeremy Falcon

      1 Reply Last reply
      0
      • Z Zahira CHOUIBA

        Hi everyone, I wrote this great script to help my team set up the weekly task distribution board, I wrote it using java script, html, and css, they've been doing it for a very long time in pencil on paper. but now i am in the final stage, i would like to convert my table to pdf, and this is where i found it difficult, i did several tests : like convert csv to pdf, it doesn't always give a good table, as it is under html. I would like to add a column at the end of the table for remarks but I think I will try with it later. now i'm just focus on pdf export. to be able to print our table every week and hang it, instead of pencil and a paper.

        Export CSVExport PDF

        const timetable = document.getElementById("timetable");

        const days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
        const hours = ["7H", "13H", "20H"];

        // Create table headers for days
        const daysHeaderRow = document.createElement("tr");
        const daysHeaderCell = document.createElement("th");
        daysHeaderCell.innerHTML = "Days";
        daysHeaderRow.appendChild(daysHeaderCell);
        days.forEach(day => {
        const dayHeaderCell = document.createElement("th");
        dayHeaderCell.innerHTML = day;
        dayHeaderCell.colSpan = 3;
        daysHeaderRow.appendChild(dayHeaderCell);
        });
        timetable.appendChild(daysHeaderRow);

        // Create table headers for hours
        const hoursHeaderRow = document.createElement("tr");
        const hoursHeaderCell = document.createElement("th");
        hoursHeaderCell.innerHTML = "Hours";
        hoursHeaderRow.appendChild(hoursHeaderCell);
        for (let i = 0; i < days.length; i++) {
        for (let j = 0; j < 3; j++) {
        const hourHeaderCell = document.c

        R Offline
        R Offline
        RickyJudith
        wrote on last edited by
        #3

        interesting

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups