当前位置: 首页>>代码示例>>Java>>正文


Java Blank类代码示例

本文整理汇总了Java中jxl.write.Blank的典型用法代码示例。如果您正苦于以下问题:Java Blank类的具体用法?Java Blank怎么用?Java Blank使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Blank类属于jxl.write包,在下文中一共展示了Blank类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mergeCells

import jxl.write.Blank; //导入依赖的package包/类
/**
 * Merges the specified cells.  Any clashes or intersections between 
 * merged cells are resolved when the spreadsheet is written out
 *
 * @param col1 the column number of the top left cell
 * @param row1 the row number of the top left cell
 * @param col2 the column number of the bottom right cell
 * @param row2 the row number of the bottom right cell
 * @return the Range object representing the merged cells
 * @exception jxl.write..WriteException
 * @exception jxl.write.biff.RowsExceededException
 */
public Range mergeCells(int col1, int row1, int col2, int row2)
  throws WriteException, RowsExceededException
{
  // First check that the cells make sense
  if (col2 < col1 || row2 < row1)
  {
    logger.warn("Cannot merge cells - top left and bottom right "+
                "incorrectly specified");
  }

  // Make sure the spreadsheet is up to size
  if (col2 >= numColumns || row2 >= numRows)
  {
    addCell(new Blank(col2, row2));
  }

  SheetRangeImpl range = new SheetRangeImpl(this, col1, row1, col2, row2);
  mergedCells.add(range);

  return range;
}
 
开发者ID:loginus,项目名称:jexcelapi,代码行数:34,代码来源:WritableSheetImpl.java

示例2: checkRanges

import jxl.write.Blank; //导入依赖的package包/类
/**
 * Checks the cell ranges for intersections, or if the merged cells
 * contains more than one item of data
 */
private void checkRanges()
{    
  try
  {
    SheetRangeImpl range = null;

    // Check all the ranges to make sure they only contain one entry
    for (int i = 0; i < ranges.size(); i++)
    {
      range = (SheetRangeImpl) ranges.get(i);

      // Get the cell in the top left
      Cell tl = range.getTopLeft();
      Cell br = range.getBottomRight();
      boolean found = false;

      for (int c = tl.getColumn(); c <= br.getColumn(); c++)
      {
        for (int r = tl.getRow(); r <= br.getRow(); r++)
        {
          Cell cell = sheet.getCell(c, r);
          if (cell.getType() != CellType.EMPTY)
          {
            if (!found)
            {
              found = true;
            }
            else
            {
              logger.warn("Range " + range + 
                          " contains more than one data cell.  " +
                          "Setting the other cells to blank.");
              Blank b = new Blank(c, r);
              sheet.addCell(b);
            }
          }
        }
      }
    }
  }
  catch (WriteException e)
  {
    // This should already have been checked - bomb out
    Assert.verify(false);
  }
}
 
开发者ID:loginus,项目名称:jexcelapi,代码行数:51,代码来源:MergedCells.java


注:本文中的jxl.write.Blank类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。