Exemplo n.º 1
0
        public void AutoSizeColumn_isColumnTrackedForAutoSizing()
        {
            workbook = new SXSSFWorkbook();
            sheet    = workbook.CreateSheet() as SXSSFSheet;

            sheet.TrackColumnsForAutoSizing(columns);
            foreach (int column in columns)
            {
                Assert.IsTrue(sheet.IsColumnTrackedForAutoSizing(column));

                Assume.That(!columns.Contains(column + 10));
                Assert.IsFalse(sheet.IsColumnTrackedForAutoSizing(column + 10));
            }
        }
Exemplo n.º 2
0
        public void AutoSizeColumn_trackAllColumns_explicitUntrackColumn()
        {
            workbook = new SXSSFWorkbook();
            sheet    = workbook.CreateSheet() as SXSSFSheet;

            sheet.TrackColumnsForAutoSizing(columns);
            sheet.TrackAllColumnsForAutoSizing();

            sheet.UntrackColumnForAutoSizing(0);
            try
            {
                sheet.AutoSizeColumn(0, useMergedCells);
                Assert.Fail("Should not be able to auto-size an explicitly untracked column");
            }
            catch (InvalidOperationException)
            {
                // expected
            }
        }
Exemplo n.º 3
0
        public void AutoSizeColumn_untrackColumnForAutoSizing()
        {
            workbook = new SXSSFWorkbook();
            sheet    = workbook.CreateSheet() as SXSSFSheet;

            sheet.TrackColumnsForAutoSizing(columns);
            sheet.UntrackColumnForAutoSizing(columns.First());

            Assume.That(sheet.TrackedColumnsForAutoSizing.Contains(columns.Last()));
            sheet.AutoSizeColumn(columns.Last(), useMergedCells);
            try
            {
                Assume.That(!sheet.TrackedColumnsForAutoSizing.Contains(columns.First()));
                sheet.AutoSizeColumn(columns.First(), useMergedCells);
                Assert.Fail("Should not be able to auto-size an untracked column");
            }
            catch (InvalidOperationException)
            {
                // expected
            }
        }
Exemplo n.º 4
0
        public void AutoSizeColumn_trackColumnsForAutoSizing()
        {
            workbook = new SXSSFWorkbook();
            sheet    = workbook.CreateSheet() as SXSSFSheet;

            sheet.TrackColumnsForAutoSizing(columns);
            SortedSet <int> sorted = new SortedSet <int>(columns);

            Assert.AreEqual(sorted, sheet.TrackedColumnsForAutoSizing);

            sheet.AutoSizeColumn(sorted.First(), useMergedCells);
            try
            {
                //assumeFalse(columns.Contains(5));
                Assume.That(!columns.Contains(5));
                sheet.AutoSizeColumn(5, useMergedCells);
                Assert.Fail("Should not be able to auto-size an untracked column");
            }
            catch (InvalidOperationException)
            {
                // expected
            }
        }