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

ENOENT, no such file or directory 'styles.xml' #26

Open
carly1987 opened this issue Jan 29, 2015 · 2 comments
Open

ENOENT, no such file or directory 'styles.xml' #26

carly1987 opened this issue Jan 29, 2015 · 2 comments

Comments

@carly1987
Copy link

export excel
router.get('/excel', function (req, res) {
var conf ={};
conf.stylesXmlFile = "styles.xml";
conf.cols = [{
caption:'string',
type:'string',
beforeCellWrite:function(row, cellData){
return cellData.toUpperCase();
},
width:28.7109375
},{
caption:'date',
type:'date',
beforeCellWrite:function(){
var originDate = new Date(Date.UTC(1899,11,30));
return function(row, cellData, eOpt){
if (eOpt.rowNum%2){
eOpt.styleIndex = 1;
}
else{
eOpt.styleIndex = 2;
}
if (cellData === null){
eOpt.cellType = 'string';
return 'N/A';
} else
return (cellData - originDate) / (24 * 60 * 60 * 1000);
}
}()
},{
caption:'bool',
type:'bool'
},{
caption:'number',
type:'number'
}];
conf.rows = [
['pi', new Date(Date.UTC(2013, 4, 1)), true, 3.14],
["e", new Date(2012, 4, 1), false, 2.7182],
["M&M<>'", new Date(Date.UTC(2013, 6, 9)), false, 1.61803],
["null date", null, true, 1.414]
];
var result = nodeExcel.execute(conf);
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
res.setHeader("Content-Disposition", "attachment; filename=" + "Report.xlsx");
res.end(result, 'binary');
});

@carly1987
Copy link
Author

cant open the ‘Report.xlsx’

@functionscope
Copy link
Owner

If stylesXmlFile is specified, you need to make sure the file is put in
correct path and has privilege to access it.

On Wed, Jan 28, 2015 at 9:28 PM, carly [email protected] wrote:

cant open the ‘Report.xlsx’


Reply to this email directly or view it on GitHub
#26 (comment)
.

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

2 participants