11 August, 2012

Create a favicon for your website

It is one of the short cut icon for an website or web page.The format for this icon is .ico. Normally 16x16 pixel icon is associated with a particular web site or web page.Other than .ico format it can support few other formats like .png,.gif. But it may not support all browser. So, .ico format is compatiable to every popular browser.Few other sizes can be used like 16×16, 32×32, 48×48, or 64×64 but , it depends on browser .

You can generate the favicon icon online also. Go for google search you can find some suggestion for creating favicon.

Example : -

http://www.favicon.cc/


Its simple. You just need a link tag on your page. Just put this tag under <HEAD></HEAD> tag of your Page. The tag like :-

<link rel="shortcut icon" href="path/location of your favicon" type="image/x-icon" /> 


Read more from wiki



08 August, 2012

Generate Excel file with single sheet in JasperReport

Yes, its quite easy to generate a excel report using Ireport . There are many blog guru's ,authors, developers has posted ample of solutions on this topic. But , still some time we are facing this problem.

Generating excel report is easy , but our requirement was all report should be come on a single sheet (not multiple sheet). We had few existing codes. But the problem was we were not about to find our exact solution. Finally after lots of testing & research got the solution.I hope it will help you.

The program code for generating Excel file from Ireport :-

JRResultSetDataSource jrds = new JRResultSetDataSource(rs);
JasperPrint print = JasperFillManager.fillReport(rptPath, hmp, jrds);
           sos=resp.getOutputStream();
            ByteArrayOutputStream baos=new ByteArrayOutputStream();
            JRXlsExporter exporterXLS = new JRXlsExporter();
            exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, print);
            exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, baos);
            //exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
            exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE , Boolean.TRUE);
            exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
            exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
            //exporterXLS.setParameter(JRXlsExporterParameter.CHARACTER_ENCODING, "UTF-8");
            exporterXLS.exportReport();
            resp.setContentType("application/vnd.ms-excel");
            resp.setHeader("Content-Disposition", "attachment; filename="+OutputFileName+".xls");
            sos.write(baos.toByteArray());
            sos.flush();
            sos.close();

 Now , you just simple remove the below line which has setParameter().When you are setting parameter for your JRXLSReporter.

The Parameter is JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE

The line i removed is //exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);


Hope it will helpfull.