
jxl 合并后的单元格怎么赋值啊?
我现在有一个excel模板,我选中单元格后给其写入数字,可是合并后的单元格,赋值的时候后台会出现:Warning:RangeA18-A27containsmorethan...
我现在有一个excel模板,我选中单元格后给其写入数字,可是合并后的单元格,赋值的时候后台会出现:
Warning: Range A18-A27 contains more than one data cell. Setting the other cells to blank.
然后整个合并后的单元格就是是空的了。 展开
Warning: Range A18-A27 contains more than one data cell. Setting the other cells to blank.
然后整个合并后的单元格就是是空的了。 展开
1个回答
展开全部
231 /***
232 * Checks the cell ranges for intersections, or if the merged cells
233 * contains more than one item of data
234 */
235 private void checkRanges()
236 {
237 try
238 {
239 SheetRangeImpl range = null;
240
241 // Check all the ranges to make sure they only contain one entry
242 for (int i = 0; i < ranges.size(); i++)
243 {
244 range = (SheetRangeImpl) ranges.get(i);
245
246 // Get the cell in the top left
247 Cell tl = range.getTopLeft();
248 Cell br = range.getBottomRight();
249 boolean found = false;
250
251 for (int c = tl.getColumn(); c <= br.getColumn(); c++)
252 {
253 for (int r = tl.getRow(); r <= br.getRow(); r++)
254 {
255 Cell cell = sheet.getCell(c, r);
256 if (cell.getType() != CellType.EMPTY)
257 {
258 if (!found)
259 {
260 found = true;
261 }
262 else
263 {
264 logger.warn("Range " + range +
265 " contains more than one data cell. " +
266 "Setting the other cells to blank.");
267 Blank b = new Blank(c, r);
268 sheet.addCell(b);
269 }
270 }
271 }
272 }
273 }
274 }
275 catch (WriteException e)
276 {
277 // This should already have been checked - bomb out
278 Assert.verify(false);
279 }
280 }
232 * Checks the cell ranges for intersections, or if the merged cells
233 * contains more than one item of data
234 */
235 private void checkRanges()
236 {
237 try
238 {
239 SheetRangeImpl range = null;
240
241 // Check all the ranges to make sure they only contain one entry
242 for (int i = 0; i < ranges.size(); i++)
243 {
244 range = (SheetRangeImpl) ranges.get(i);
245
246 // Get the cell in the top left
247 Cell tl = range.getTopLeft();
248 Cell br = range.getBottomRight();
249 boolean found = false;
250
251 for (int c = tl.getColumn(); c <= br.getColumn(); c++)
252 {
253 for (int r = tl.getRow(); r <= br.getRow(); r++)
254 {
255 Cell cell = sheet.getCell(c, r);
256 if (cell.getType() != CellType.EMPTY)
257 {
258 if (!found)
259 {
260 found = true;
261 }
262 else
263 {
264 logger.warn("Range " + range +
265 " contains more than one data cell. " +
266 "Setting the other cells to blank.");
267 Blank b = new Blank(c, r);
268 sheet.addCell(b);
269 }
270 }
271 }
272 }
273 }
274 }
275 catch (WriteException e)
276 {
277 // This should already have been checked - bomb out
278 Assert.verify(false);
279 }
280 }
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询