예제 #1
0
        public void TestBug57828_OnlyOneCommentShiftedInRow()
        {
            XSSFWorkbook wb    = XSSFTestDataSamples.OpenSampleWorkbook("57828.xlsx");
            XSSFSheet    sheet = wb.GetSheetAt(0) as XSSFSheet;

            IComment comment1 = sheet.GetCellComment(new CellAddress(2, 1));

            Assert.IsNotNull(comment1);

            IComment comment2 = sheet.GetCellComment(new CellAddress(2, 2));

            Assert.IsNotNull(comment2);

            IComment comment3 = sheet.GetCellComment(new CellAddress(1, 1));

            Assert.IsNull(comment3, "NO comment in (1,1) and it should be null");

            sheet.ShiftRows(2, 2, -1);

            comment3 = sheet.GetCellComment(new CellAddress(1, 1));
            Assert.IsNotNull(comment3, "Comment in (2,1) Moved to (1,1) so its not null now.");

            comment1 = sheet.GetCellComment(new CellAddress(2, 1));
            Assert.IsNull(comment1, "No comment currently in (2,1) and hence it is null");

            comment2 = sheet.GetCellComment(new CellAddress(1, 2));
            Assert.IsNotNull(comment2, "Comment in (2,2) should have Moved as well because of shift rows. But its not");

            wb.Close();
        }
예제 #2
0
        public void TestBug57828_OnlyOneCommentShiftedInRow()
        {
            XSSFWorkbook wb    = XSSFTestDataSamples.OpenSampleWorkbook("57828.xlsx");
            XSSFSheet    sheet = wb.GetSheetAt(0) as XSSFSheet;

            IComment comment1 = sheet.GetCellComment(2, 1);

            Assert.IsNotNull(comment1);

            IComment comment2 = sheet.GetCellComment(2, 2);

            Assert.IsNotNull(comment2);

            IComment comment3 = sheet.GetCellComment(1, 1);

            Assert.IsNull(comment3, "NO comment in (1,1) and it should be null");

            sheet.ShiftRows(2, 2, -1);

            comment3 = sheet.GetCellComment(1, 1);
            Assert.IsNotNull(comment3, "Comment in (2,1) Moved to (1,1) so its not null now.");

            comment1 = sheet.GetCellComment(2, 1);
            Assert.IsNull(comment1, "No comment currently in (2,1) and hence it is null");

            comment2 = sheet.GetCellComment(1, 2);
            Assert.IsNotNull(comment2, "Comment in (2,2) should have Moved as well because of shift rows. But its not");

            //        OutputStream stream = new FileOutputStream("/tmp/57828.xlsx");
            //        try {
            //          wb.Write(stream);
            //        } finally {
            //          stream.Close();
            //        }

            wb.Close();
        }
예제 #3
0
 /// <summary>
 /// Returns cell comment for the specified location
 /// </summary>
 /// <param name="ref1">cell location</param>
 /// <returns>return cell comment or null if not found</returns>
 public IComment GetCellComment(CellAddress ref1)
 {
     return(_sh.GetCellComment(ref1));
 }
예제 #4
0
 public IComment GetCellComment(int row, int column)
 {
     return(_sh.GetCellComment(row, column));
 }