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 05:42:29 GMT

hey thanks a lot i shall try converting the whole code to Usermodel based but
i am a newbie so finding it difficult...is there any site which provides
suggestions or information on alternative methods with the same use...this
is a part of the code  ...i would like to build the remaining based on this
...

public byte[] serialize() {
		int wbsize    = m_workBook.getSize();
		int totalsize = wbsize;
		for (int k = 0; k <= m_numOfSheets;k++){
			m_workBook.setSheetBof(k, totalsize);
			totalsize += getSheet(k).getSize();
		}
		if(totalsize < 4096) {
			totalsize = 4096;
		}
		byte[] workBookStream = new byte[totalsize];
		int pos = serializeWorkBook(workBookStream);
		pos += this.serializeSheets(workBookStream,pos);
		for(int k = pos; k < totalsize; k++){
			workBookStream[k] = 0;
		}
		System.out.println("TotalSize="+totalsize+" and Pos="+pos);
		return workBookStream;
	}


getsize() and setSheetbof(..) are the two mothds here which are to be
replaced ...


	private long getSheetSize(int sheetIndex) throws IOException{
		long size = this.sheetsStream[sheetIndex].getFilePointer();
		Sheet sheet = getSheet(sheetIndex);

		size += getSheetInternalRecordsSize(sheetIndex, true);
		
		if(columnWidthBytes!= null && columnWidthBytes[sheetIndex] != null){
		    size += columnWidthBytes[sheetIndex].size();
		}
		
		if(rowBytes!= null && rowBytes[sheetIndex] != null){
		    size += rowBytes[sheetIndex].size();
		}
		
		size +=
((Record)(sheet.getRecords().get(sheet.getDimsLoc()))).getRecordSize();
		size += getSheetInternalRecordsSize(sheetIndex, false);
		
		return size;
	}
sheet.getRecords() and sheet.getDimsLoc() are showing error here....



-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Using-HSSF-record-methods-for-a-SS-usermodel-tp3246532p3247960.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