本文整理汇总了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;
}
示例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);
}
}