1 / 4

Display contents of a Data Table in Excel right from the browser – No POI needed

Display contents of a Data Table in Excel right from the browser – No POI needed. This section describes how to display the contents of a data table in the browser as an Excel spreadsheet programmatically, using EGL server-side logic. Display Data Table as Excel in the Browser.

everly
Download Presentation

Display contents of a Data Table in Excel right from the browser – No POI needed

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Display contents of a Data Table in Excel right from the browser – No POI needed This section describes how to display the contents of a data table in the browser as an Excel spreadsheet programmatically, using EGL server-side logic.

  2. Display Data Table as Excel in the Browser • How many times have you heard, “The data on the web page is just what I asked for! But, now what I really want is use the data in an Excel spreadsheet”. • Fortunately, your efforts have not gone to waste. You are just a few simple steps – and literally minutes – away from providing exactly what the user wants. • Here’s how: • Take an ordinary EGL generated web page having a dataTable. • Add a commandButton to the page • Use an Excel image (.gif) for the button instead of text • Add an Excel-specific page with the data table only • Drag-drop the array onto an empty page – that’s all! • Keep the Excel page simple • Simple page and cell formatting will likely be rendered as desired • Complex JSF properties and actions will likely be troublesome • Besides, the excel user will likely re-size, re-sort and re-render the spreadsheet in more ways than you can imagine. • Let’s see how it works 

  3.  Data Table in Excel Browser Lab 1 of 2 – Create the Page and JSFHandler • Create a new page, named: allcustomersExcel.jsp– no need for a page template • Copy/Paste the EGL code from the Notes section of the slide, and replace the default JSFHandler with this code • From Page Data: • Drag customersArray onto the page • Remove Pager: From properties, select dataTable – uncheck: Show footer • NOTE: • Keep the page simple

  4.  Data Table in Excel Browser Lab 1 of 2 – Add command button • Set the ContentType on page • Click the Source tab • Add <% response.setContentType("application/vnd.ms-excel"); %> prior to the <html> tag • Open allcustomers2.jsp: • Add Excel image to project • Download an Excel image from the web (or copy from this slide) • Copy Excel image and paste into WebContent\images folder • Drag and drop a Command Button from the Enhanced Faces pallet • From properties view – Display options: • Set the Type property by clicking the Image radio button • insert - images/ExcelButton.gif – into Normal image • Copy/Paste the EGL function – ShowInExcel – from the notes section into the JSPHandler • Bind the function to the command button • From the Page Data view – Actions: drag/drop ShowInExcel() onto the command button • Run the page on the server • Click the Excel button • depending on your security settings, you may get a File Download dialog – click open to continueand see Excel in the browser.

More Related