Bug 46703

Summary: There is no setDisplayZeros(boolean) method in HSSFSheet
Product: POI Reporter: Maksym Symonov <Maksym_Symonov>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.2-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Maksym Symonov 2009-02-12 00:58:04 UTC
There are setDisplayGridlines() and other methods, which call
protected Sheet HSSFSheet.getSheet() and then Sheet.windowTwo.setDisplayGridlines(). There is setDisplayZeros() method in WindowTwoRecord class, but it can't be called from HSSFSheet.
Fix of it is easy to implement by adding getter/setter methods to HSSFSheet and Sheet.

Currently the way to implement it is using of reflection:

Field sheetField = HSSFSheet.class.getDeclaredField( "sheet" );
			sheetField.setAccessible( true );
			Sheet sheet = (Sheet)sheetField.get( hssfSheet );
			
			Field windowTwoRecordField = Sheet.class.getDeclaredField( "windowTwo" );
			windowTwoRecordField.setAccessible( true );
			WindowTwoRecord windowTwoRecord = (WindowTwoRecord)windowTwoRecordField.get( sheet );
			windowTwoRecord.setDisplayZeros( false );
Comment 1 Yegor Kozlov 2009-02-24 00:41:44 UTC
Fixed in r747307. 

I added setDisplayZeros / isDisplayZeros to HSSFSheet, XSSFSHeet and common interface org.apache.poi.ss.usermodel.Sheet.

Regards,
Yegor