FarPoint为单元格增加备注

private void Form3_Load(object sender, EventArgs e)
        {
            List<Hashtable> list = new List<Hashtable>();

            Hashtable ht1 = new Hashtable();
            ht1.Add("key", "测试");
            ht1.Add("value", "测试备注");
            list.Add(ht1);

            SheetView sheet = this.fpSpread1.Sheets[0];

            sheet.RowCount = list.Count;

            for (int i = 0; i < sheet.RowCount; i++) 
            {
                sheet.Cells[i, 0].Value = list[i]["value"].ToString();
                sheet.Cells[i, 0].Note = "我的备注";
                sheet.Cells[i, 0].NoteIndicatorColor = sheet.Cells[i, 0].BackColor;
                Size size = new Size();
                size.Width = (int)sheet.Columns[0].Width;
                size.Height = (int)sheet.Rows[i].Height;
                sheet.Cells[i,0].NoteIndicatorSize = size;
                sheet.Cells[i,0].NoteStyle = NoteStyle.StickyNote;
            }
        }

其中NoteIndicatorColor是备注在单元格中的小方格的背景色,NoteIndicatorSize是备注在单元格中小方格的尺寸,NoteStyle有三个属性,第一个是隐藏备注不显示,第二格式只有鼠标放在小方格上才显示,第三个是一直显示且可拖动。

你可能感兴趣的:(poi)