Create Excel file in Java -


I want to create an excel file and write java and write a text file. I tried changing the file extension from .txt to .xls . But I want the bold file in the Excel file. How can I go about doing this?

I have tried to use JXL API, but every time I have to make a label, I want to add no labels. Can not the row and column of the table be edited?

  // find jar from here "http://poi.apache.org/download .html "import java.io. *; Import org.apache.poi.hssf.usermodel.HSSFSheet; Import org.apache.poi.hssf.usermodel.HSSFWorkbook; Import org.apache.poi.hssf.usermodel.HSSFRow; Import org.apache.poi.hssf.usermodel.HSSFCell; Public category CreateExlFile {public static zero main (string [] args) {try {string filename = "c: / newxilfile.xls"; HSSFWorkbook Workbook = New HSSFWorkbook (); HSSFSheet sheet = workbook.createSheet ("FirstSheet"); HSSFRow rowhead = sheet.createRow ((short) 0); Rowhead.createCell (0) .setCellValue ("no."); Rowhead.createCell (1) .setCellValue ("name"); Rowhead.createCell (2) .setCellValue ("address"); Rowhead.createCell (3) .setCellValue ("email"); HSSFRow Row = sheet.createRow (Short) 1); Row.createCell (0) .setCellValue ("1"); Row.createCell (1) .setCellValue ("Sankumarsingh"); Row.createCell (2) .setCellValue ("India"); Row.createCell (3) .setCellValue ("sankumarsingh@gmail.com"); FileOutputStream fileout = new FileOutputStream (filename); Workbook.write (fileOut); FileOut.close (); System.out.println ("Your excel file has been created!"); } Hold (Exception Pre) {System.out.println (ex); }}}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -