meteor-excel
meteor-excel copied to clipboard
how to generate excel file from existing excel template?
I would to generate excel file from existing template. Please example.
@rabbittc You are talking about Meteor Template ? I think to get that done you will have to manipulate a lot of DOM. Better find another way...
You can make a XLS with a collection, MeteorPad Example is good way to start. And if you want to make it reusable do a MODEL. So everytime you need to export to XLS/X call that method.
But if you still want to use a whole template better try the question on StackOverflow.
Excuse me I want to generat excel file from existing excel file. By set other value to cell name and we can use other property like merge cell, background color....
Each cell is an object you can change the value, the style.... lot of people asked that on the js-xlsx repo, check it
i tested it and works pull request ready
var excel = new Excel('xls');
var yourFile = basepath+'server/Test.xls';
var workbook = excel.readFile(yourFile);
var yourSheetNames = workbook.SheetNames;
var specificCell = workbook.Sheets[yourSheetNames[0]]['A1'];
specificCell.v = "test2";
var valueSpecificCell = workbook.Sheets[yourSheetNames[0]]['A1'].v;
console.log(valueSpecificCell);
excel.writeFile(workbook, yourFile);
BUT!
The writeFile is not implemented, yet
Like i said before i pull request this patch to netanelgilad:excel.js
Excel.prototype.writeFile = function (wb, write_path) {
if (this.fileType === 'xlsx') {
return XLSX.writeFile(wb, write_path);
}
else if (this.fileType === 'xls') {
return XLSX.writeFile(wb, write_path);
}
};
_And well.. the function is the same for XLS than XLSX._
Very thanks, I will try.
Now this is merged yet?