* <P>
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Glen Stampoultzis (glens at apache.org)
- * @author Shawn Laubach (slaubach at apache dot org) Gridlines, Headers, Footers, and PrintSetup
+ * @author Shawn Laubach (slaubach at apache dot org) Gridlines, Headers, Footers, PrintSetup, and Setting Default Column Styles
* @author Jason Height (jheight at chariot dot net dot au) Clone support. DBCell & Index Record writing support
* @author Brian Sanders (kestrel at burdell dot org) Active Cell support
*
if (columns == null)
columns = new ColumnInfoRecordsAggregate();
- columns.setColumn( column, width, level, hidden, collapsed );
+ columns.setColumn( column, null, width, level, hidden, collapsed );
}
+ public void setColumn(short column, Short xfStyle, Short width, Integer level, Boolean hidden, Boolean collapsed)
+ {
+ if (columns == null)
+ columns = new ColumnInfoRecordsAggregate();
+
+ columns.setColumn( column, xfStyle, width, level, hidden, collapsed );
+ }
+
+
/**
* Creates an outline group for the specified columns.
* @param fromColumn group from this column (inclusive)
columnInfo = writeHidden( columnInfo, idx, true );
// Write collapse field
- setColumn( (short) ( columnInfo.getLastColumn() + 1 ), null, null, null, Boolean.TRUE);
+ setColumn( (short) ( columnInfo.getLastColumn() + 1 ), null, null, null, null, Boolean.TRUE);
}
public void expandColumn( short columnNumber )
}
// Write collapse field
- setColumn( (short) ( columnInfo.getLastColumn() + 1 ), null, null, null, Boolean.FALSE);
+ setColumn( (short) ( columnInfo.getLastColumn() + 1 ), null, null, null, null, Boolean.FALSE);
}
/**
}
- public void setColumn(short column, Short width, Integer level, Boolean hidden, Boolean collapsed)
+ public void setColumn(short column, Short xfIndex, Short width, Integer level, Boolean hidden, Boolean collapsed)
{
ColumnInfoRecord ci = null;
int k = 0;
if (ci != null)
{
+ boolean styleChanged = xfIndex != null && ci.getXFIndex() != xfIndex.shortValue();
boolean widthChanged = width != null && ci.getColumnWidth() != width.shortValue();
boolean levelChanged = level != null && ci.getOutlineLevel() != level.intValue();
boolean hiddenChanged = hidden != null && ci.getHidden() != hidden.booleanValue();
boolean collapsedChanged = collapsed != null && ci.getCollapsed() != collapsed.booleanValue();
- boolean columnChanged = widthChanged || levelChanged || hiddenChanged || collapsedChanged;
+ boolean columnChanged = styleChanged || widthChanged || levelChanged || hiddenChanged || collapsedChanged;
if (!columnChanged)
{
// do nothing...nothing changed.
else if ((ci.getFirstColumn() == column)
&& (ci.getLastColumn() == column))
{ // if its only for this cell then
- setColumnInfoFields( ci, width, level, hidden, collapsed );
+ setColumnInfoFields( ci, xfIndex, width, level, hidden, collapsed );
}
else if ((ci.getFirstColumn() == column)
|| (ci.getLastColumn() == column))
nci.setLastColumn(column);
nci.setOptions(ci.getOptions());
nci.setXFIndex(ci.getXFIndex());
- setColumnInfoFields( nci, width, level, hidden, collapsed );
+ setColumnInfoFields( nci, xfIndex, width, level, hidden, collapsed );
insertColumn(k, nci);
}
nci.setLastColumn(column);
nci.setOptions(ci.getOptions());
nci.setXFIndex(ci.getXFIndex());
- setColumnInfoFields( nci, width, level, hidden, collapsed );
+ setColumnInfoFields( nci, xfIndex, width, level, hidden, collapsed );
insertColumn(++k, nci);
nci = ( ColumnInfoRecord ) createColInfo();
nci.setFirstColumn(column);
nci.setLastColumn(column);
- setColumnInfoFields( nci, width, level, hidden, collapsed );
+ setColumnInfoFields( nci, xfIndex, width, level, hidden, collapsed );
insertColumn(k, nci);
}
}
/**
* Sets all non null fields into the <code>ci</code> parameter.
*/
- private void setColumnInfoFields( ColumnInfoRecord ci, Short width, Integer level, Boolean hidden, Boolean collapsed )
+ private void setColumnInfoFields( ColumnInfoRecord ci, Short xfStyle, Short width, Integer level, Boolean hidden, Boolean collapsed )
{
+ if (xfStyle != null)
+ ci.setXFIndex(xfStyle.shortValue());
if (width != null)
ci.setColumnWidth(width.shortValue());
if (level != null)
level = Math.min(7, level);
fromIdx = columnIdx - 1; // subtract 1 just in case this column is collapsed later.
}
- setColumn((short)i, null, new Integer(level), null, null);
+ setColumn((short)i, null, null, new Integer(level), null, null);
columnIdx = findColumnIdx( i, Math.max(0, fromIdx ) );
collapseColInfoRecords( columnIdx );
}