You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Ethan Baldridge <et...@superiordocumentservices.com> on 2008/12/13 00:08:07 UTC

Unhiding columns doesn't seem to work

Hello,

I'm having some issues. I'm trying to simply take input files which are
existing XLS or XLSX files and unhide everything.

Unhiding sheets works fine, but this block of code:

for (int col = maxCellsThisSheet; col < cellsThisRow; col++)
{
	wb.getSheetAt(i).setColumnHidden(col, false);
	//wb.getSheetAt(i).setColumnGroupCollapsed((int)col, false);
}
(i is the current value in a loop from 0 to wb.getNumberOfSheets())

is having some issues. Instead of unhiding columns, it makes all columns
hidden (and setColumnHidden(col,true) instead of false still has the
same effect) and if I uncomment the setColumnGroupCollapsed line, Excel
won't load the output, saying the sheet is corrupt. Could somebody tell
me what I'm doing wrong?

Thanks,
-- 
Ethan Baldridge <et...@superiordocumentservices.com>
Superior Document Services

Re: Unhiding columns doesn't seem to work

Posted by Ethan Baldridge <et...@superiordocumentservices.com>.
er, maxCellsThisSheet is initialized to zero, then gets incremented
AFTER the for() loop if the number of cells this row is greater. This
loop also only gets used in that case. I realized after I sent it that
that might look a little odd out of context. :)

On Fri, 2008-12-12 at 18:08 -0500, Ethan Baldridge wrote:
> Hello,
> 
> I'm having some issues. I'm trying to simply take input files which are
> existing XLS or XLSX files and unhide everything.
> 
> Unhiding sheets works fine, but this block of code:
> 
> for (int col = maxCellsThisSheet; col < cellsThisRow; col++)
> {
> 	wb.getSheetAt(i).setColumnHidden(col, false);
> 	//wb.getSheetAt(i).setColumnGroupCollapsed((int)col, false);
> }
> (i is the current value in a loop from 0 to wb.getNumberOfSheets())
> 
> is having some issues. Instead of unhiding columns, it makes all columns
> hidden (and setColumnHidden(col,true) instead of false still has the
> same effect) and if I uncomment the setColumnGroupCollapsed line, Excel
> won't load the output, saying the sheet is corrupt. Could somebody tell
> me what I'm doing wrong?
> 
> Thanks,
-- 
Ethan Baldridge <et...@superiordocumentservices.com>
Superior Document Services