How Can I export a JavaScript Generated HTML Table to Excel? - javascript

I really shot myself in the foot this time. I'm using JavaScript to build an HTML table on one of my pages. I got everything to work fine but I can't copy this table into Excel like a normal HTML table.
I'm pretty sure it has to do with the fact it's a JS-generated table (using d3.js specifically) as when you look at the page source in the web browser, the table is obviously not there except for the few bits that were hard coded into HTML.
My problem is, I need to work with this data in Excel. I use to build these tables using PHP and that was fine but someone suggested I migrate to d3.js and didn't realize I would run into this problem. For example, if I select the entire table and copy/paste special into Excel in any way it dumps it all into one cell instead of parsing it properly.
I'm kind of stuck in a time crunch to get this data out of the browser and into Excel so rewriting my web page isn't an option.
Idea?

Related

Is it possible to import an excel table to a site and make it searchable?

Thank you in advance for any help.
So i have a table that has 100 rows and 4 columns. I want to publish it on to a site and make it searchable (filtering etc). Now i know one can use OneDrive to get a responsive table on excel itself but i am not allowed to use One drive for security Reasons. The way i have it setup right now i have to create the table in html in Dreamweaver then it is searchable using JavaScript. This is great for small tables but for large tables it takes forever to build the table in html i was wondering if there is a way to import an excel file to do this instead of building the table in html and make it searchable. I found the following thread that says how to do it i think but i am not full understanding it. I just want to know Is this something that is possible or am i wasting my time.
https://chandoo.org/forum/threads/save-excel-as-web-page-html-and-filter-table-how-to-achieve-this.31669/

Convert HTML + CSS to PDF with Javascript

I have an desing page(.cshtml) document that renders fine in all browser(FireFox, Chrome and IE). It uses fairly basic CSS to style it and renders fine in HTML.
I'm trying to convert it's one DIV to PDF, but I am facing issue like white spaces and page break. I have tried:
jsPDF : It had huge problems with HTML tables. I factored out my large tables and it helped but it makes a complete mess of tables and doesn't seem to get images. The tables were just break after page end. It doesn't print properly.
Windows Print : I also simply tried with windows print option in javascript, but it automatically takes the site logo image on every page of PDF and it get overlaped on data lines.
nReco : I also tried with nReco tool to convert HTML to PDF, but I am getting same output as above.
What am I missing, or how can I resolve this issue?
Try using html2pdf library as it is an easier to implement library. I have myself faced issues with jspdf and html2pdf has helped solve complex svg/grid related issues.

Interactively create PDF file from javascript generated html

I have a webpage with an interactive paged grid rendered using javascript. i.e. it's a grid that pulls in a number of rows at a time through MVC ajax call and have controls for going forward, backwards or jumping to a particular page. It is a fairly large grid (potentially millions of rows) and can display a number of different datasets. I would like to be able to generate a PDF containing a snapshot of each and every page from this dynamic grid. All the libraries I have looked at transfering html to pdf have all been static, anybody know of a good fast library to transfer interactive/dynamic javascript generated html to pdf? I am willing to do this at the server layer as well, if it is possible to import the .css skins used to create the grid on the webpage, to make the look similar.
I am not sure if that fits your needs, but I used
http://www.tcpdf.org/
some time ago, and it worked quite good. But no idea how good it works with javascript and stuff.
For the record I ended up using LocalReport From Microsoft.Reporting.WebForms.

Handsontable - slow paste

When I try pasting large amounts of data into handsontable it is very slow at taking in the data to the point that sometimes I get an unresponsive script warning for the jquery.js file. Is there a way to make is go any faster? The dataset I am using right now is ~1600 rows and 5 columns.
Here is the link to the table I am trying to paste in currently http://wiki.stat.ucla.edu/socr/index.php/SOCR_Data_Dinov_042108_Antarctic_IceThicknessMawson
Thanks
Try upgrading to the latest version:
http://handsontable.com/
This should now be resolved

Micro Javascript templates not rendering correct in IE, but works fine without javascript?

This is a bit of an odd issue I'm having. I've been using John Resig' micro-templates for a meeting minutes application, and it seemed to work well, but lately I've been having an issue.
Basically the application fetches some JSON from an ajax call, and then uses the templating engine to generate a table with various actions like so:
This works fine, its a little slow in IE (javascript rendering) but it works. However randomly I'll get a stuff up in the display:
notice the gap there, its pushed it out wide, also, its made the rest of the rows squish up. I've tried every CSS/HTML trick I can think of to try and get IE to render it properly, but I'm out of ideas (any suggestions would be great!) . I'm using JQuery Sortable so you can drag each of those rows around, I noticed that when you drag it and place it again, it displays correctly. It's as if it thinks theres an extra TD there, when there isn't.
So I opened the IE developer tools and copied the inner HTML of the HTML element. Pasted this into a HTML file and put it on the server, turned off the JS so it wouldn't reload the elements and ran the page. It displays perfectly, just as in my first image.
So I'm confused as to why IE will render the page fine if the HTML is present from the start, but the templating engine causes odd stuff ups.
I'll probably look at rendering that part of the HTML on the server, and only use the templating where I need to. But has anyone come across this sort of issue before? is there any trick I can do to make it render it as it should?
we had similar problem in our company and our designer solved it. Solution was in concatenating tags one after another without spaces and/or without new line. Code is not looking great after that but still solves problem.
Thanks,
Nikola

Categories