poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohankrishnajasti <rohankrishnaja...@gmail.com>
Subject Re: Using HSSF.record methods for a SS.usermodel
Date Wed, 03 Nov 2010 11:07:55 GMT

public void createSerializedCell(short cellType, int sheetIndex,int
rowIndex,short colIndex,short styleIndex,String mDimDesc) throws
IOException{
		Record cellRecord = null;
		switch(cellType){
			case NUMERIC_CELL:
				cellRecord = createNumericCellRecord(sheetIndex, rowIndex, colIndex,
styleIndex, Double.parseDouble(mDimDesc.toString()));
				break;}

		int recSize = cellRecord.getRecordSize();
		byte recBytes[] = new byte[recSize];			
		cellRecord.serialize(0,recBytes);

		if(sheetsStream!=null && sheetsStream[sheetIndex] != null){
		    sheetsStream[sheetIndex].write(recBytes,0,recBytes.length);
		}
		recBytes = null;
		cellRecord = null;		
	}



public NumberRecord createNumericCellRecord(int sheetIndex,int
rowIndex,short colIndex,short styleIndex,double value){
		CellValueRecordInterface cellRecord = new NumberRecord();
		(( NumberRecord ) cellRecord).setColumn(colIndex);
		(( NumberRecord ) cellRecord).setRow(rowIndex);
		(( NumberRecord ) cellRecord).setValue(value);
		(( NumberRecord ) cellRecord).setXFIndex(styleIndex);
		return (NumberRecord)cellRecord;
	}
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Using-HSSF-record-methods-for-a-SS-usermodel-tp3246532p3248255.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message