How do I download contents of an html table generated by play 1.2.7 backend on java in xls - html

I've generated a table using play's #{list} tag and get pretty decent results. Now I need to be able to generate and download an xls version of the table and have no idea what to do. Any pointers at all will be much appreciated

Well you have various options.
Excel will open HTML files. So instead of rendering your table as HTML you can it to stream it to the browser and set the content type as XLS.
While Excel will open it this it will still be an HTML file rather than an XLS(X) document.
You can generate as CSV from your data model and stream this to the browser. Again this will be a CSV rather than a proper XLS(X) document.
There also seem to be some solutions around which can do it using Javscript. See as a starting point: Generate excel sheet from html tables using jquery
Finally you can can use something like Apache POI or JXLS to generate a 'proper' xls(x) document and stream this to the browser. I have some code here that will export HTML to 'proper' xlsx file if this is the route you wish to go. Workflow is then to create some HTML from your data model and use this to convert to Excel rather than having to programmatically build the Excel document using POI. https://github.com/alanhay/html-exporter

Related

How can I interact with html file in delphi intraweb?

Hi I am currently working on delphi intraweb. I try to import html template file to the program instead of hard-code it by using components from tool palette. However, I cannot find anyway to interact with the html file satisfyingly. For example, I want to handle the values of input box in the html file or adding data to data table through delphi. Or should I perform the tasks through other aspects?
I am using IWTemplateProcessorHTML to load external html template to delphi but I couldnt figure out a way to pass values from the html file to delphi or from delphi to that html file in run-time. There is not coding involved yet.
Thanks.

R Writing Excel Document

My question is whether or not anybody knows of a better way to do what I'm already doing. I'm creating a report as a list, and trying to render it both in HTML and Excel.
I'm developing a shiny app that generates reports for Qualtrics surveys.
The results table is a list of HTML strings that I paste together and display in a shinydashboard. Here's a dput of the example results tables.
Here's how I'm creating the html results tables list -- the html_tabelize() function in my package. Here's a dput of the example input.
In the shiny server.R file the way I create the Excel file is with the following code:
output$downloadResults <- downloadHandler(
filename = 'tables.xls',
content = function(file) {
write(html_tabelize(main()[['blocks']]), file)
}
)
To summarize: I get the blocks, I run html_tabelize on them, and then I write the HTML output to a file called "tables.xls". When I open that file, because Excel can render HTML, it renders something like this:
My concern and problem with what I'm doing are two-fold:
If I were writing an Excel document instead of simply rendering HTML in Excel, then I could perhaps get a better formatted document. I'd like that.
When you download the results tables xls file and try to open it, you get a warning from Excel. I don't want the users of my app to see this warning, because it's distracting and could worry them about something that isn't really a concern.
I know that options exist for writing Excel files in R, but so far what I've seen indicates that their input must be either a data frame, or a list of data frames. The list I am rendering from has different types of components, like the question text, as well as data frames of results. Originally I was using pandoc, but pandoc, even when run from R, is a system binary, and it's difficult to list as a dependency (and if I can't list it as a dependency, it's tough to make sure it's installed for the users of my app). Additionally, I found out pandoc doesn't even convert to "real" Excel -- it also just saves HTML in a .xls file. Does anybody have any suggestions as to how I can improve this part of my app?

Creating a CSV file with the Report Generation Toolkit in Labview

I want to create .csv files with the Report Generation Toolkit in Labview.
They must actually be .csv files which can be opened with Notepad or something similar.
Creating a .csv is not that hard, it's just a matter of adding the extension to the file name that's going to be created.
If I create a .csv file this way it opens nicely in excel just the way it should, but if I open it in Notepad it shows all kind of characters and it doesn't even come close to the data I wrote to the file.
I create the files with the Labview code below:
Link to image (can't post image yet because I've got to few points)
I know .csv files can be created with the Write to Spreadsheet VI but I would like to use the Report Generation Toolkit because it's pretty easy to add columns and rows to the file and that is something I really need.
you can use the Robust CSV package on the lavag.org forum to read and write 2D arrays to CSV files.
http://lavag.org/files/file/239-robust-csv/
Calling a file "csv" does not make it a CSV file. I never used the toolkit to generate an Excel file, but I'm assuming it creates an XLS or XLSX file, regardless of what extension you give it, which is why you're seeing gibberish (probably XLS, since it's been around for a while and I believe XLSX is XML, not binary).
I'm not sure what your problem is with the write spreadsheet VI. It has an append input, so I assume you can use that to at least add rows directly to a file, although I can't say I ever tried it. I would prefer handling all the data in memory explicitly, where you can easily use the array functions to add rows or columns to the array and then overwrite the entire file.

How to paste tabular data into an HTML table

I have an HTML table on a webpage and can edit the contents manually. However, it would make my life much easier if I can copy the data from a file to the clipboard and just paste in onto the form. Can BHOs in IE do this? Any pointers will be helpful.
I have a superset of the data in a file and I don't want to type it all into the webpage.
If your file can be saved as a CSV (using Excel or some other program), then you can use a tool such as the one here (or write your own) to convert it to HTML.

Ways to export Tables/Views from mySQL Database to printer friendly format (other than phpMyAdmin)

I've created a bunch of views in a database and I'd like to export them to pdf. However phpmyadmin lets me only put a title on each page and it's very limited to how i can layout the output.
does anybody have some recommendations of software/scripts they used?
tcpdf is a PHP class for generating pdf documents. They have many example scripts.
There are a fantastillion ways to do this, some ideas:
export csv, import it to your favorite spreadsheet editor, format it, get the pdf using a pdf printer.
export xml, process it using xsl-fo to produce the output you want ( hacking required, fun )
export html ( should work? ), put a css on top optimized for print layout, pdf-printer.
Usually, I write up a script to pull info from a database, then generate a .csv, attach it to an email and send it on its way. Most scripts with support for mySQL can do that and they also go as far as generate a .pdf file with the appropriate formatting (in my case, I use Ruby, so I could have used Prawn to generate a PDF - I just choose not to as of this time).