Giter VIP home page Giter VIP logo

excel-export's People

Contributors

nicolaslopezj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

excel-export's Issues

Uncaught ReferenceError: Excel is not defined at Object...

Hi i'm trying to export mongodb records to xlsx since client side in my meteor app, but when i run the code, the console shows me the below message:

Uncaught ReferenceError: Excel is not defined at Object.click .exportar

NOTE: I installed the package in my project: meteor add nicolaslopezj:excel-export

Could you tell me what goin up with this? Thank you so much. i'll be hoping for any advance or help

tree.html

...<div class="col-md-2 col-md-offset-7 col-xs-2 col-xs-offset-3">
    <button type="button" class="btn exportar">Exportar a XLSX</button>
</div>...

tree.js

Template.tree.events({
  'click .exportar': function() {
    var data = Scrapers.find({id_usuario : Busquedas.findOne({sec : Busquedas.find().count()}).id_investigador}).fetch();
    var fields = [
      {
        key: 'autor',
        title: 'Autor',
      },
      {
        key: 'institucion',
        title: 'Institucion'
      },
      {
        key: 'campos',
        title: 'Campos de Investigacion'
      },
      {
        key: '#',
        title: 'Publicaciones',
      },
      ,
      {
        key: '#',
        title: 'Coautores',
      },
      {
        key: 'citas_totales',
        title: 'Citas totales',
      },
      {
        key: 'citas_2012',
        title: 'Citas 2012',
      },
      {
        key: 'indice_h_totales',
        title: 'Indice h totales',
      },
      {
        key: 'indice_h_2012',
        title: 'Indice h 2012',
      },
      {
        key: 'indice_i10_totales',
        title: 'Indice i10 totales',
      },
      {
        key: 'indice_i10_2012',
        title: 'Indice i10 2012',
      }
    ];

    var title = 'Scrapers';
    var file = Excel.export(title, fields, data);
    var headers = {
      'Content-type': 'application/vnd.openxmlformats',
      'Content-Disposition': 'attachment; filename=' + title + '.xlsx'
    };

    this.response.writeHead(200, headers);
    this.response.end(file, 'binary');
  }
}, {where : 'client'});

excel download

ERROR - Meteor.userId can only be invoked in method calls. Use this.userId in publish functions.
How can solve this ?

Treating Array and Object Values

Thanks a lot for this package. Very helpful to me. Wondering how to render an array of strings and treating objects (which structure varies based on user). example below, i want to convert the contents of the array to string using arr.toString()

"preferred_industries" : [
      "Accountancy",
       "Agriculture",
        "fashion",
        "music",
        "ministry"
    ]

I tried this.

{
        key: "preferences.preferred_industries",
        title: "Industries",
        type: "string",
        transform: function(val, doc) {
          return val.toString();
        }
      }

how can i achieve this type of thing. Thanks

Restricted Download access

Hi, thanks for this package
I have a download route in my app using your package, which i want to restrict access to. The route code is as follows

Router.route("/download-data",  function() {
var data = Meteor.users.find({ "profile.user_type": "employee" }).fetch();
var fields = [...fields];

var title = "Employee - Users";

var file = Excel.export(title, fields, data);

var headers = {
  "Content-type": "application/vnd.openxmlformats",
  "Content-Disposition": "attachment; filename=" + title + ".xlsx"
};

 this.response.writeHead(200, headers);
 this.response.end(file, "binary");
 },
 { where: "server" }
);

The route automatically downloads a file. This is currently working but I want to restrict access to the route. I only want admins to be able to download it.

I have created an onBeforeAction Hook as below

Router.onBeforeAction(
  function() {
    //using alanning:roles
    if(Roles.userIsInRole(this.userId, "admin"){
     console.log('message') //testing
   }
  },
  {
    only: ["downloadData"]
  }
);

and renamed my route as below

//code above
this.response.writeHead(200, headers);
 this.response.end(file, "binary");
 },
 { where: "server", name: "downloadData" }
);

The onBeforeAcion hook does not take any effect

Also I noticed neither this.userId nor Meteor.userId works on the route

Excel is not recognized

Hi,

I've tried to use this component in a Meteor method but I'm struggle with the Excel namespace not recognized:

import { DocumentCollection } from '../both/collections/document.collection';


Meteor.methods({
    exportDocuments: function () {
        var data = DocumentCollection.find({}).fetch();
        var fields = [
            {
                key: 'id',
                title: 'URL',
            },
            {
                key: 'message',
                title: 'Message'
            },
            {
                key: 'viewsCount',
                title: 'Views',
                type: 'number'
            }
        ];

        var title = 'Posts';
        var file = Excel.export(title, fields, data);
        var headers = {
            'Content-type': 'application/vnd.openxmlformats',
            'Content-Disposition': 'attachment; filename=' + title + '.xlsx'
        };

        this.response.writeHead(200, headers);
        this.response.end(file, 'binary');


    }
});

Even when I try to import import {Excel} from 'meteor/nicolaslopezj:excel-export' it says that import meteor/nicolaslopezj:excel-export cannot be find. I did the meteor add meteor/nicolaslopezj:excel-export. I don't know what need to be done.

Can you help?

row count

Hi!
Does it supports more than 1760 rows? I have over 3k documents in collection, but it only writes 1760 rows if i put even more than this count.

Excel is not defined

thanks for this package! after following the docs I am getting an error which is "Excel is not defined". what could be the problem here?

Uncaught TypeError: Cannot read property 'export' of undefined

Hello @nicolaslopezj :
I've a app that has one button when is pressed, it should export any records of my collections in mongodb.
But when i press it, the console show me the below message:

Uncaught TypeError: Cannot read property 'export' of undefined

Can you help me whit this please? Thanks

import {Excel} from 'meteor/nicolaslopezj:excel-export'

Template.tree.events({
'click .exportar': function() {
var data = Scrapers.find({id_usuario : Busquedas.findOne({sec : Busquedas.find().count()}).id_investigador}).fetch();
var fields = [
{
key: 'autor',
title: 'Autor',
},
{
key: 'institucion',
title: 'Institucion'
},
{
key: 'campos',
title: 'Campos de Investigacion'
},
{
key: '#',
title: 'Publicaciones',
},
,
{
key: '#',
title: 'Coautores',
},
{
key: 'citas_totales',
title: 'Citas totales',
},
{
key: 'citas_2012',
title: 'Citas 2012',
},
{
key: 'indice_h_totales',
title: 'Indice h totales',
},
{
key: 'indice_h_2012',
title: 'Indice h 2012',
},
{
key: 'indice_i10_totales',
title: 'Indice i10 totales',
},
{
key: 'indice_i10_2012',
title: 'Indice i10 2012',
}
];

var title = 'Scrapers';
var file = Excel.export(title, fields, data);
var headers = {
  'Content-type': 'application/vnd.openxmlformats',
  'Content-Disposition': 'attachment; filename=' + title + '.xlsx'
};

this.response.writeHead(200, headers);
this.response.end(file, 'binary');

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.