POI api Projects

POI api Project 1

How to Set Sheet Name and Compressed Unicode
Previous Home Next


In this page of the example we are going to set the sheet name and compress it. There are following methods can be used for built in data format.

setSheetName(int sheet, String name):- 
This method is provide the facility to set the sheet name in Excel. 

setSheetName(int sheet, String name, short encoding):- 
This method is used to detect the automatically unicode and sets its encoding appropriately. Simply we can use the setSheetName(int sheet, String encoding) method. this has the facility to set the unicode for setting encoding appropriately.

setSheetName(int sheet, String name):-
This method is also used to set the sheet name. It is throw IllegalArgumentException if we are take the name which is greater than 31 chars or contains /\,?,*,[,],etc then it will throws the exception.

setSheetName( int sheet, String name, short encoding):-
This method is automatically detects Unicode and sets the encoding appropriately. for performing this operation we can used the setSheetName(int sheet, String encoding).

package r4r;
import java.io.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.usermodel.HSSFRow;
public class setsheetnamecompressed {
	public static void main(String arg[]) {
		FileOutputStream out = new FileOutputStream
		HSSFWorkbook hssfworkbook = new HSSFWorkbook();
		HSSFCellStyle cs = hssfworkbook.createCellStyle();
		"\u0422\u0441\u0422\u043E\u0432\u0430\u044F " + 
		  HSSFWorkbook.ENCODING_UTF_16 );
		}catch(Exception e){}

Previous Home Next