I am trying to create a table with autotable so I can explain the meaning of some abbreviations I have used before. The data comes from a database but let’s say that it is like this once it’s fetched:
const subjectMap = {ENG:'english', SPA:'Spanish', HIS:'History', SCI:'Science', ...}
As I need to get the key in a column and the value in the following column I did the following:
var tempRows = []
for (const [key, value] of Object.entries(subjectMap)) {
var temp = [key, value];
tempRows.push(temp)
}
doc.autoTable({
body:
tempRows
});
That gives me a table with two columns and as many rows as subjects I have in the map, however I would like to have just two rows and position the following subjects in additional columns. The result should be something like this:
COLUMN1 COLUMN2 COLUMN3 COLUMN4
ROW1 ENG English HIS History
ROW2 SPA Spanish SCI Science
Maybe I could get to do it not using autotable and just using the doc.addtext in jspdf. I don’t need any formatting or lines, just the explication for each abbreviation and in order to save space I want them filling out the horizontal page like that.
Thank you.