Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColSpan is buggy #1074

Open
sdancer75 opened this issue Oct 17, 2024 · 0 comments
Open

ColSpan is buggy #1074

sdancer75 opened this issue Oct 17, 2024 · 0 comments

Comments

@sdancer75
Copy link

I anticipated that the last row of the table would be merged using colSpan, but it doesn't seem to work.

Example of the code

   const handleViewPDF = () => {
      const raw = [
         { name: 'Torrey Becker', email: 'Maci.Kreiger@hotmail.com', city: 'Cremin bury' },
         { name: 'Jared Corwin', email: 'Felicia76@gmail.com', city: 'Bergstrom land' },
         { name: 'Jocelyn Zboncak', email: 'Dr.Jermaine_Langosh@hotmail.com', city: 'Fritsch town' },
         { name: 'Emilio Wyman', email: 'Justus.Kessler@hotmail.com', city: 'North Noah mouth' },
         { name: '_Torrey Becker', email: 'Maci.Kreiger@hotmail.com', city: 'Cremin bury' },
         { name: '_Jared Corwin', email: 'Felicia76@gmail.com', city: 'Bergstrom land' },
         { name: '_Jocelyn Zboncak', email: 'Dr.Jermaine_Langosh@hotmail.com', city: 'Fritsch town' },
         { name: '_Emilio Wyman', email: 'Justus.Kessler@hotmail.com', city: 'North Noah mouth' },
      ];
      // eslint-disable-next-line
      const doc = new jsPDF('p', 'pt');

      const body = [];

      // eslint-disable-next-line
      for (let i = 0; i < raw.length; i += 1) {
         const row = [];
         // eslint-disable-next-line
         for (let key in raw[i]) {
            row.push(raw[i][key]);
         }

         body.push(row);
      }

      body.push({
         colSpan: 3,
         content: 'Merged (colSpan=3)',
         styles: { valign: 'middle', halign: 'center' },
      });

      doc.autoTable({
         startY: 60,
         body,
         theme: 'grid',
      });
      doc.save(`report.pdf`);
   };
   

the PDF created

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant