meteor-excel icon indicating copy to clipboard operation
meteor-excel copied to clipboard

how to generate excel file from existing excel template?

Open rabbittc opened this issue 10 years ago • 5 comments
trafficstars

I would to generate excel file from existing template. Please example.

rabbittc avatar Apr 25 '15 01:04 rabbittc

@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.

cristiandley avatar May 07 '15 11:05 cristiandley

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....

thearabbit avatar May 07 '15 12:05 thearabbit

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._

cristiandley avatar May 07 '15 16:05 cristiandley

Very thanks, I will try.

thearabbit avatar May 08 '15 02:05 thearabbit

Now this is merged yet?

thearabbit avatar Jul 24 '15 02:07 thearabbit