Skip to content
This repository has been archived by the owner on Nov 14, 2017. It is now read-only.

how to generate excel file from existing excel template? #6

Open
rabbittc opened this issue Apr 25, 2015 · 5 comments
Open

how to generate excel file from existing excel template? #6

rabbittc opened this issue Apr 25, 2015 · 5 comments

Comments

@rabbittc
Copy link

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

@cristiandley
Copy link
Contributor

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

@thearabbit
Copy link

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

@cristiandley
Copy link
Contributor

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

@thearabbit
Copy link

Very thanks, I will try.

@thearabbit
Copy link

Now this is merged yet?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants