The image uploaded to excel with the recipe htmltoxlsx is not visible, while the recipe xlsx works correct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getXLSX = async (template, data, helpers = '') => { | |
try { | |
console.log(data) | |
return client.render({ | |
template: { | |
content: template, | |
recipe: 'html-to-xlsx',//'xlsx',// | |
engine: 'handlebars', | |
helpers: helpers, | |
}, | |
data: data, | |
htmlToXlsx: { | |
htmlEngine: "phantom", //chrome phantom | |
encoding:"base64" | |
}, | |
fileExtension: 'xlsx', | |
options: { | |
reports: { | |
save: true | |
}, | |
language: "es", | |
timeout: 25000 | |
} | |
}, { timeout: 25000 }); | |
} catch (error) { | |
return error; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.tableconfig { | |
font-family: Arial; | |
text-align: center; | |
width: 1000px ; | |
padding: 0px; | |
border: 1px solid; | |
} | |
.alignleft { | |
text-align: left; | |
} | |
.alignright { | |
text-align: right; | |
} | |
.widthPorc14{ | |
width: 14.5%; | |
} | |
.widthPorc30{ | |
width: 30%; | |
} | |
.widthPorc12{ | |
width: 12%; | |
} | |
.tam12{ | |
font-size: 16px; | |
} | |
.tam10{ | |
font-size: 13px; | |
} | |
.tam8{ | |
font-size: 11px;; | |
} | |
.tam7{ | |
font-size: 10px;; | |
} | |
.color { | |
color: rgb(15, 15, 15); | |
} | |
.color td { | |
background-color:rgb(201, 205, 209); | |
} | |
.tdheader { | |
background-color:rgb(165, 166, 170); | |
} | |
.negrita{ | |
font-family: Arial; | |
font-weight: bold; | |
} | |
td{ | |
text-align: center; | |
font-family: Arial; | |
} | |
</style> | |
<table class="tableconfig" data-sheet-name="title"> | |
<tr class="color"><td></td><td rowspan="3"><img src='{#asset Imagenes/2ok.jpg @encoding=base64}' alt="" ></td><td></td><td></td><td></td><td></td><td></td><td></td></tr> | |
<tr class="color"><td></td> <td class="tam12 negrita" colspan="5">title</td><td></td></tr> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"extensions": { | |
"assets": { | |
"allowedFiles": "**/*.*", | |
"searchOnDiskIfNotFoundInStore": true, | |
"rootUrlForLinks": "http://sapiens.udenar.edu.co/cdn/images/", | |
"publicAccessEnabled": true | |
}, | |
"authentication": { | |
"cookieSession": { | |
"secret": "unodostres" | |
}, | |
"admin": { | |
"username": "admin", | |
"password": "123" | |
}, | |
"enabled": true | |
}, | |
"scripts": { | |
"timeout": 40000, | |
"strategy": "http-server" | |
}, | |
"sample-template": { | |
"createSamples": true | |
} | |
}, | |
"httpPort": 5488, | |
"store": { | |
"provider": "fs" | |
}, | |
"blobStorage": { | |
"provider": "fs" | |
}, | |
"logger": { | |
"console": { | |
"transport": "console", | |
"level": "debug" | |
}, | |
"file": { | |
"transport": "file", | |
"level": "info", | |
"filename": "logs/reporter.log" | |
}, | |
"error": { | |
"transport": "file", | |
"level": "error", | |
"filename": "logs/error.log" | |
} | |
}, | |
"allowLocalFilesAccess": true, | |
"templatingEngines": { | |
"timeout": 10000, | |
"strategy": "http-server" | |
}, | |
"chrome": { | |
"timeout": 40000 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var excel = await funcionesReporte.getXLSX( | |
fs.readFileSync(__dirname + '/reportes/template-balance-general/template-EXCEL/htmlToXlsx.html' ).toString(),//BGeneralxlsx.html').toString(), | |
// htmlToXlsx.html' ).toString(), | |
dataRes, | |
fs.readFileSync(__dirname + '/reportes/helpers.js', 'utf8').toString() | |
); | |
res.contentType('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); | |
res.header('Content-Disposition": "filename=Balance_General.xlsx"') | |
res.status(200) | |
console.log('OK EXCEL'); | |
res.status(200); | |
excel.pipe(res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{#xlsxAddImage "test" "sheet1.xml" 1 0 2 3}} | |
{#asset Imagenes/2ok.jpg @encoding=base64} | |
{{/xlsxAddImage}} | |
{{{xlsxPrint}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment