poi生成多个批注的问题

如果插入多个批注,只会显示一个

其问题是每个批注对象只能插入一次。。。在其他单元格再次插入就会重新定位之类的。。。类似于重新赋值

解决办法就是新建多几个批注对象

/**
	 * 创建一列应用列头
	 * 
	 * @param userinfosheet1
	 * @param userName
	 * @param list
	 *        String数组的形式存放数据
	 */
	public void creatAppRowHead(HSSFSheet userinfosheet1, int naturalRowIndex,String[] list) {
		HSSFRow row = userinfosheet1.createRow(naturalRowIndex - 1);
		//创建绘图对象
        HSSFPatriarch p=userinfosheet1.createDrawingPatriarch();
		//获取批注对象
        //(int dx1, int dy1, int dx2, int dy2, short col1, int row1, short col2, int row2)
        //前四个参数是坐标点,后四个参数是编辑和显示批注时的大小.
        HSSFComment comment=p.createComment(new HSSFClientAnchor(0,0,0,0,(short)3,3,(short)5,6));
        HSSFComment comment1=p.createComment(new HSSFClientAnchor(0,0,0,0,(short)3,3,(short)5,6));
        HSSFComment comment2=p.createComment(new HSSFClientAnchor(0,0,0,0,(short)3,3,(short)5,6));
        //输入批注信息
        HSSFRichTextString text = new HSSFRichTextString("输入格式:2017-06-01");
        comment.setString(text);
        comment1.setString(text);
        comment2.setString(text);
		for (int i = 0; i < list.length; i++) {
			HSSFCell Cell = row.createCell(i);
			Cell.setCellValue(list[i]);
			Cell.setCellStyle(titleStyle);
		}
		
		row.getCell(1).setCellComment(comment);
		row.getCell(22).setCellComment(comment1);
		row.getCell(23).setCellComment(comment2);
	}

 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值