Export html tables to Excel using (or not) javascript - javascript

I made an statistics application which only permits actually to display various informations, using angular. Now i want to improve it.
On a page i have 3 big html tables containing the statistics and i'd like to let the users download them to use them on excel.
I've seen many ways to do it only in javascript but it's a bit too basic and for example, we can ony create one sheet by excel file. I used for a previous project a php Class to create my excel files which was really better.
Can you advise me about a way to create a more complex excel file, on my angular application, by calling maybe an external script or something?
Thank you very much

There are a plenty of solutions for your problem. All depends of your application, backend capabilities, frameworks used and so on...
A solution could be to create a webservice that uses the Apache POI apis.

Related

How to export report excel in website using angularjs

I want to export file to excel like this in my website. Is there any way to make it ? If can't do that with angularjs, please give me any suggestion(tool,lib or another languages can embedded to my website support this) to do that. Thanks.
This is file execel:
In our team we had a similar issue and we searched a lot for solution, we didn't find any good tool for this task except for creating a simple csv file, so in the end we decided to do all the reporting (PDF, Excel ,...) in server side.

How to create and download a file in PDF and docx format which is to be created from the data in table in AngularJS?

I'm a newbie to AngularJS and using AngularJS for my web app.
On one page of my web app, I'm fetching data from database and displaying in a table. The data is in JSON format. And, since it contains multiple entries of the same type, it's an array.
I want to provide a Download button to the user and a radio button with the options of .pdf and .docx.
The User will select one of the file formats and click on Download button in order to download the data displayed in table into the selected file format on his/her local machine.
How to achieve it? Can someone please guide me in this regard?
Since the code to fetch and display data in table is too big that's why I haven't given any code snippet here.
If you want I can provide you the same.
If you can explain with some completely working examples for both file formats(.docx and .pdf) in AngularJS it would be really really great to me and other buddies.
Thanks.
There are some few good resources. I use https://mozilla.github.io/pdf.js/ for PDF and https://github.com/evidenceprime/html-docx-js for docx though it needs some manipulations.
Try these that I could find. This is not supposed to be a list of options but each of them have different functionalities. But it surely does not make sense making your own port for these.
PDF
http://pdfkit.org/ for extended PDF formatting
https://github.com/tuckerjt07/pdfmake allows for PDF formatting
https://github.com/Prashanth-Nelli/jsPdfTablePlugin Straight forward simple usage
http://github.com/MrRio/jsPDF frequently used
DOCx
http://github.com/MrRio/DOCX.js
https://github.com/evidenceprime/html-docx-js
Angular UI-Grid has implemented PDF/CSV Export from grid.
Please refer UI-Grid Export Data
They are using Pdfmake to generate PDF of exported data.
just google for a javascript library that enable you to easily convert your json data to PDF, something like http://github.com/MrRio/jsPDF – Naigel Mar 29 at 9:52
the same person also created this http://github.com/MrRio/DOCX.js – jcubic Mar 29 at 9:54
I'd agree, there's nothing gained from building it yourself unless it's a specialised system, but yours sounds like a very standard way of doing things so it would be far better to use a pre-made system and not waste the time that could be spent better developing the bespoke parts of the system.

Generate a PDF from a site running javascript

I need a way to generate a pdf-file of a site that runs alot of javascript.. any ideas of how to do it..or is there any package that I can use or something?
Thanks in advance!
EDIT
Should add that I need to generate this server-side using asp.net.
Doing it server-side I would recommend iTextSharp or Docmosis, and the Docmosis cloud services could also let you create it by a http post from Javascript). They both allow your application to create PDF documents with a rich set of features for layout and content. If you say more about what is in the PDFs you need to create then it might be clearer which you would choose. Please note I work for the company that created Docmosis.

How to easily read xls doc on dynamic site?

Programming noobie here. I'm working on a website where users fill out a form and based on their input a given value from a big excel sheet is displayed on the page. I know JS, jQuery, HTML/CSS, and Python but I haven't learned how to use any framework like Django yet. I'm wondering how I can most easily read values from the xls doc. It looks like xlrd is a good bet. I'm doing this project on a tight deadline though so I'm not sure I have time to learn a framework like Django and it seems like overkill for something as simple as this. Can I use xlrd for the website without learning a framework? And more broadly, what's the simplest way to implement this solution (i.e. read values from an XLS doc onto a web page)?
Django is a big framework, consider using Flask microframework (it shouldn't take your more than 4 hours to get the basics and put together simple application).
The easiest approach would be to go with Microsoft technology stack - you can expose quite easily Excel sheet as Web Service, so the web page can read it data as JSON or XML.

blogengine without php or asp.net etc

Is there a way to have a blog directly integrated into my HTML/javascript-only website, without having to have something like a SQL-database and a dynamic engine like PHP or MySQL?
Maybe there is some service in the web that offers this (hopefully without ads :) ). Or maybe I can have a blog engine entirely written in javasript?
Entirely written in JavaScript? Surely that defeats the entire point of having a "blog-engine" in the first place? The point being that the data is stored somewhere and dynamically retrieved. To avoid using anything server-side (which seems to be your intent), and only use HTML/JavaScript, you'd have to store all the data for the blog in files that are served up to each visitor, and then retrieve the data from the particular, local, locations using JavaScript.
Sorry if I'm misunderstanding the point here... but this seems to be an utterly useless way of trying to go about things. Blogs are, in general, either written statically (in HTML [even though this is rare]), or are dynamically generated from a database by a server-side scripting language (most common).
Edit: As an additional point, I suppose you could include some third-party blog feed, or service, in your page, via use of JavaScript... but I'm unsure as to which (if any) blogging services would directly support this method of working. Additionally, this is quite an unreliable way of including third-party data in a page...
Here's a thought. It's not really a blog engine - but a wiki.
Entirely javascript/html/css. All lives in a single html file:
http://www.tiddlywiki.com/
not sure how it would work on a real live site, but their site is using it:
* A personal notebook
* A GTD ("Getting Things Done") productivity tool
* A collaboration tool
* For building websites (this site is a TiddlyWiki file!)
* For rapid prototyping
* ...and much more!
You could use github pages. You will get a generated blog with version control.
Other option is to use a Desktop blog tool and then update your site.
You can user iWeb if you have a Mac or CityDesk on Windows or you may try this open source tool
Edit Today I came across this tool: Zeta producer that may help.
http://code.google.com/p/showdown-blog/
Blog engine written in just JS and XML [v0.6] {JavaScript, XML}
So, what you want is to have a blog where you're website provider doesn't provide a way to serve dynamic content?
The only way I see that you can do it in that case is writing html-files (or text-files if you prefer) and adding them to the site. After that you can have some JavaScript to add them to your "blog-page".
You of course need to upload them to the website in the same way as you do for the other files, and then have a way for the JavaScript to know which pages it should fetch.
I am not aware of any JavaScript blog-engines, but you can have a look at the templating functions in for instance Prototype
Of course, that means that you will have to fetch both the template and the content through Ajax and let the client do all the processing (could be slow and possibly insecure), and you still need to have a place to upload the content and update it.
Your best bet is going to be using a generator to create the HTML/CSS/JS to upload to your server, take a look at Webby: http://webby.rubyforge.org/
IF you really need to you can use a public api for a service that lets you post small bits of info and retrieve it using javascript.
for example if you only need small posts you can make a blog in html.javascript that utilizes twitter as the engine. of course you will be limited to 140 chars. I am sure there are other services that will allow a similar idea but with less restrictions.
And of course the best option - Get a blog software or host your blog with a service provider and link to it from you site.
Good luck
One solution would be to use some application that generates the static web pages of your blog, and uploads them to your web server. This way you'd have a blog with static content that could all be managed in javascript alongside your existing site, without needing to install database, daemon software, or additional dynamic web programming languages on your server. The static content generation could happen directly on your server if possible, or you could run the html generation tool locally and upload the output.
MoveableType has a tool like this. You still need somewhere to store the content of your blog, and for this MoveableType uses MySQL by default, so you'd still need to install a database somewhere, but the database could simply be one your local desktop.
MoveableType also has support via plugins or older versions that can retrieve data from a sqlite or other database. The advantage of sqlite is that it doesn't require installing daemons like MySQL does, you can just put a sqlite file on disk somewhere, give MoveableType the path to the file, and run the script to generate your static content.
There are likely other tools like MoveableType, and I have in the past generated blog-like web pages simply by writing small scripts to generate HTML. The main issue is just that you need somewhere for these scripts to fetch data from.
Another option might be to develop your blog using XSLT, ... with XSLT, you'd put the content of your pages in XML files, and then write a template in XSL that converts your XML to HTML.
If you google for 'static blog site generation' you might find other ideas/options, including Jekyll/github mentioned in one of the other responses.

Categories