Example #1
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
            }
        }
Example #2
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
            }
        }