Merge pull request #3799 from Enishowk/feature/excel_parentNameExport

Feature/excel parent card name export
reviewable/pr3813/r1
Lauri Ojansivu 4 years ago committed by GitHub
commit 595abd303c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 49
      models/exportExcel.js

@ -235,7 +235,7 @@ export class ExporterExcel {
},
{
key: 'b',
width: 20,
width: 40,
},
{
key: 'c',
@ -243,25 +243,11 @@ export class ExporterExcel {
},
{
key: 'd',
width: 20,
style: {
font: {
name: TAPi18n.__('excel-font'),
size: '10',
},
numFmt: 'yyyy/mm/dd hh:mm:ss',
},
width: 40,
},
{
key: 'e',
width: 20,
style: {
font: {
name: TAPi18n.__('excel-font'),
size: '10',
},
numFmt: 'yyyy/mm/dd hh:mm:ss',
},
},
{
key: 'f',
@ -321,6 +307,13 @@ export class ExporterExcel {
{
key: 'k',
width: 20,
style: {
font: {
name: TAPi18n.__('excel-font'),
size: '10',
},
numFmt: 'yyyy/mm/dd hh:mm:ss',
},
},
{
key: 'l',
@ -346,6 +339,10 @@ export class ExporterExcel {
key: 'q',
width: 20,
},
{
key: 'r',
width: 20,
},
];
//add title line
@ -430,7 +427,7 @@ export class ExporterExcel {
size: 10,
bold: true,
};
ws.mergeCells('F3:Q3');
ws.mergeCells('F3:R3');
ws.getCell('B3').style = {
font: {
name: TAPi18n.__('excel-font'),
@ -509,6 +506,7 @@ export class ExporterExcel {
TAPi18n.__('number'),
TAPi18n.__('title'),
TAPi18n.__('description'),
TAPi18n.__('parent-card'),
TAPi18n.__('owner'),
TAPi18n.__('createdAt'),
TAPi18n.__('last-modified-at'),
@ -542,6 +540,7 @@ export class ExporterExcel {
allBorder('O5');
allBorder('P5');
allBorder('Q5');
allBorder('R5');
cellCenter('A5');
cellCenter('B5');
cellCenter('C5');
@ -559,6 +558,7 @@ export class ExporterExcel {
cellCenter('O5');
cellCenter('P5');
cellCenter('Q5');
cellCenter('R5');
ws.getRow(5).font = {
name: TAPi18n.__('excel-font'),
size: 12,
@ -586,6 +586,13 @@ export class ExporterExcel {
jclabel += jlabel[jcard.labelIds[jl]];
jclabel += ' ';
}
//get parent name
if (jcard.parentId) {
const parentCard = result.cards.find(
card => card._id === jcard.parentId,
);
jcard.parentCardTitle = parentCard ? parentCard.title : '';
}
//add card detail
const t = Number(i) + 1;
@ -593,6 +600,7 @@ export class ExporterExcel {
t.toString(),
jcard.title,
jcard.description,
jcard.parentCardTitle,
jmeml[jcard.userId],
addTZhours(jcard.createdAt),
addTZhours(jcard.dateLastActivity),
@ -627,6 +635,7 @@ export class ExporterExcel {
allBorder(`O${y}`);
allBorder(`P${y}`);
allBorder(`Q${y}`);
allBorder(`R${y}`);
cellCenter(`A${y}`);
ws.getCell(`B${y}`).alignment = {
wrapText: true,
@ -634,15 +643,15 @@ export class ExporterExcel {
ws.getCell(`C${y}`).alignment = {
wrapText: true,
};
ws.getCell(`L${y}`).alignment = {
wrapText: true,
};
ws.getCell(`M${y}`).alignment = {
wrapText: true,
};
ws.getCell(`N${y}`).alignment = {
wrapText: true,
};
ws.getCell(`O${y}`).alignment = {
wrapText: true,
};
}
workbook.xlsx.write(res).then(function() {});
}

Loading…
Cancel
Save