コード例 #1
0
ファイル: TestSheet.cs プロジェクト: thinhmascot/NPOI
        public void TestRowValueAggregatesOrder_bug45145()
        {
            Sheet sheet = Sheet.CreateSheet();

            RowRecord rr = new RowRecord(5);

            sheet.AddRow(rr);

            CellValueRecordInterface cvr = new BlankRecord();

            cvr.Column = 0;
            cvr.Row    = (5);
            sheet.AddValueRecord(5, cvr);


            int dbCellRecordPos = GetDbCellRecordPos(sheet);

            if (dbCellRecordPos == 252)
            {
                // The overt symptom of the bug
                // DBCELL record pos is1 calculated wrong if VRA comes before RRA
                throw new AssertFailedException("Identified  bug 45145");
            }

            Assert.AreEqual(242, dbCellRecordPos);
        }
コード例 #2
0
ファイル: TestSheet.cs プロジェクト: thinhmascot/NPOI
        /**
         * Checks for bug introduced around r682282-r683880 that caused a second GUTS records
         * which in turn got the dimensions record out of alignment
         */
        public void TestGutsRecord_bug45640()
        {
            Sheet sheet = Sheet.CreateSheet();

            sheet.AddRow(new RowRecord(0));
            sheet.AddRow(new RowRecord(1));
            sheet.GroupRowRange(0, 1, true);
            sheet.ToString();
            IList recs  = sheet.Records;
            int   count = 0;

            for (int i = 0; i < recs.Count; i++)
            {
                if (recs[i] is GutsRecord)
                {
                    count++;
                }
            }
            if (count == 2)
            {
                throw new AssertFailedException("Identified bug 45640");
            }
            Assert.AreEqual(1, count);
        }
コード例 #3
0
        /// <summary>
        /// Loads cards into a new Sheet and returns the Sheet object
        /// </summary>
        /// <param name="cards"></param>
        /// <returns></returns>
        private static Sheet BuildSheetFrom(IEnumerable<XElement> cards)
        {
            Debug.Assert(cards != null, "cards = null");

            cards = cards.ToList();

            TraceLog.WriteLine(new StackFrame().GetMethod().Name, "building sheet from " + cards.Count() + " cards.");

            var sheet = new Sheet();

            var row = sheet.AddRow();

            // Add a title row with column names. This could be made optional.
            // Avoid potential performance issue with double enumeration by enumerating a list
            foreach (var x in cards.First().Descendants())
            {
                row.AddColumn().Value = x.Name.LocalName;
            }

            foreach (var card in cards)
            {
                AddRow(sheet.AddRow(), card);
            }

            return sheet;
        }