コード例 #1
0
 private void CorrectForCellIndex(Row row)
 {
     while (reader.MoveToNextAttribute())
     {
         if (IsIndexAttribute())
         {
             row.AddEmptyCells(GetMissingCount(row.CellCount));
         }
     }
 }
コード例 #2
0
 private static bool IsDivider(Row row)
 {
     return row.IsEmpty();
 }
コード例 #3
0
 private static bool IsComment(Row row)
 {
     List<Cell> cells = row.Cells;
     return cells.Count > 0 && !cells[0].IsEmpty();
 }
コード例 #4
0
ファイル: RawTestTest.cs プロジェクト: manderdev/monkeypants
 private static void AssertDataRowFilled(Row dataRow, int length)
 {
     Assert.AreEqual(length, dataRow.CellCount);
     dataRow.Cells.ForEach(cell => Assert.IsFalse(string.IsNullOrEmpty(cell.Value)));
 }
コード例 #5
0
ファイル: RawTest.cs プロジェクト: manderdev/monkeypants
 private void AssertCorrectDataLength(Row dataRow, int headerCellCount)
 {
     int dataCellCount = dataRow.CellCount;
     if (dataCellCount != headerCellCount)
     {
         throw new MalformedTestException(
             string.Format("Cannot initialize test - mismatch in number of headers and data values. [headers {0}, cells {1}]. Title: {2}", headerCellCount, dataCellCount, Title));
     }
 }
コード例 #6
0
 private static bool IsComment(Row currentRow)
 {
     if (currentRow.Cells.Count == 0) return false;
     string value = currentRow.Cells[0].Value;
     return value != null && value.StartsWith("*");
 }
コード例 #7
0
            private void ReadRowCells(Row row)
            {
                while (true)
                {
                    reader.MoveToNextElement();

                    if (reader.IsStartElement("Cell"))
                    {
                        ReadCell(row);
                    }

                    if (reader.IsEndElement("Row"))
                    {
                        return;
                    }
                }
            }
コード例 #8
0
            void ReadRow(Table table)
            {
                reader.AssertIsStartElement("Row");

                bool isEmptyRow = reader.IsEmptyElement;
                if (isEmptyRow)
                {
                    table.AddEmptyRow();
                }

                CorrectForRowIndex(table);

                if (! isEmptyRow)
                {
                    var row = new Row();
                    table.AddRow(row);
                    ReadRowCells(row);
                }
            }
コード例 #9
0
            private void ReadCellData(Row row)
            {
                bool dataRead = false;
                while (true)
                {
                    reader.MoveToNextElement();
                    if (reader.IsStartElement("Data"))
                    {
                        if (dataRead) throw new ApplicationException("Multiple Data elements within a Cell element");

                        row.AddCell(new Cell(ReadData()));
                        dataRead = true;
                    }

                    if (reader.IsEndElement("Cell"))
                    {
                        if (!dataRead) row.AddEmptyCell();
                        return;
                    }
                }
            }
コード例 #10
0
            void ReadCell(Row row)
            {
                reader.AssertIsStartElement("Cell");

                bool isEmptyCell = reader.IsEmptyElement;
                if (isEmptyCell)
                    row.AddEmptyCell();

                CorrectForCellIndex(row);

                if (!isEmptyCell)
                    ReadCellData(row);
            }
コード例 #11
0
ファイル: Table.cs プロジェクト: manderdev/monkeypants
 public void AddRow(Row row)
 {
     Rows.Add(row);
 }