예제 #1
0
        public void trackAndUntrackAllColumns()
        {
            Assume.That(tracker.TrackedColumns.Count == 0);
            tracker.TrackAllColumns();
            Assert.IsTrue(tracker.TrackedColumns.Count == 0);

            IRow row = sheet.CreateRow(0);

            foreach (int column in columns)
            {
                row.CreateCell(column);
            }
            // implicitly track the columns
            tracker.UpdateColumnWidths(row);
            Assert.AreEqual(columns, tracker.TrackedColumns);

            tracker.UntrackAllColumns();
            Assert.IsTrue(tracker.TrackedColumns.Count == 0);
        }
예제 #2
0
        private void FlushOneRow()
        {
            KeyValuePair <int, SXSSFRow> firstRow = _rows.FirstOrDefault();

            //KeyValuePair is struct, so check value instead of key
            if (firstRow.Value != null)
            {
                int      firstRowNum = firstRow.Key;
                int      rowIndex    = firstRowNum;
                SXSSFRow row         = _rows[firstRowNum];
                // Update the best fit column widths for auto-sizing just before the rows are flushed
                _autoSizeColumnTracker.UpdateColumnWidths(row);
                _writer.WriteRow(rowIndex, row);
                _rows.Remove(firstRowNum);
                lastFlushedRowNumber = rowIndex;
            }
        }