Logo Search packages:      
Sourcecode: jexcelapi version File versions  Download package

void jxl::write::biff::WritableSheetImpl::setColumnView ( int  col,
CellView  view 
) [inline]

Sets the view for this column

Parameters:
col the column on which to set the view
view the view to set

Implements jxl::write::WritableSheet.

Definition at line 1328 of file WritableSheetImpl.java.

References jxl::biff::FormattingRecords::addStyle(), autosizedColumns, columnFormats, jxl::CellView::depUsed, formatRecords, jxl::CellView::getDimension(), jxl::CellView::getFormat(), jxl::write::biff::Styles::getNormalStyle(), jxl::CellView::getSize(), jxl::write::biff::WritableWorkbookImpl::getStyles(), getWorkbook(), jxl::CellView::isAutosize(), jxl::CellView::isHidden(), jxl::biff::XFRecord::isInitialized(), logger, jxl::write::biff::ColumnInfoRecord::setHidden(), and jxl::common::Logger::warn().

  {
    XFRecord xfr =  (XFRecord) view.getFormat();
    if (xfr == null)
    {
      Styles styles = getWorkbook().getStyles();
      xfr = styles.getNormalStyle();
    }

    try
    {
      if (!xfr.isInitialized())
      {
        formatRecords.addStyle(xfr);
      }
      
      int width = view.depUsed() ? view.getDimension() * 256 : view.getSize();

      if (view.isAutosize())
      {
        autosizedColumns.add(new Integer(col));
      }

      ColumnInfoRecord cir = new ColumnInfoRecord(col, 
                                                  width, 
                                                  xfr);

      if (view.isHidden())
      {
        cir.setHidden(true);
      }

      if (!columnFormats.contains(cir))
      {
        columnFormats.add(cir);
      }
      else
      {
        columnFormats.remove(cir);
        columnFormats.add(cir);
      }
    }
    catch (NumFormatRecordsException e)
    {
      logger.warn("Maximum number of format records exceeded.  Using " +
                  "default format.");

      ColumnInfoRecord cir = new ColumnInfoRecord
        (col, view.getDimension()*256, WritableWorkbook.NORMAL_STYLE);
      if (!columnFormats.contains(cir))
      {
        columnFormats.add(cir);
      }
    }
  }


Generated by  Doxygen 1.6.0   Back to index