Пример #1
0
        private static bool IsWysiwygFormattedRow(SpreadsheetRow row)
        {
            var key = row.MetadataKey;

            // At this point we're treating all content rows except the headers (and some labels) as wysiwyg
            return(key != InternalSpreadsheet.RowTypeColumnLabel && key.StartsWith("[") && key.EndsWith("]"));
        }
Пример #2
0
 public void AddRow(SpreadsheetRow row)
 {
     _rows.Add(row);
     row.Spreadsheet = this;
 }
Пример #3
0
 private static void ReadRow(ExcelWorksheet worksheet, int rowIndex, int colCount, SpreadsheetRow row)
 {
     for (var c = 0; c < colCount; c++)
     {
         ExcelRange currentCell = worksheet.Cells[rowIndex + 1, c + 1];
         // The first row is special because it contains the headers needed by IsWysiwygFormattedColumn
         if (rowIndex > 0 && IsWysiwygFormattedColumn(row, c) &&
             IsWysiwygFormattedRow(row))
         {
             row.AddCell(BuildXmlString(currentCell));
         }
         else
         {
             var cellContent = worksheet.Cells[rowIndex + 1, c + 1].Value ?? "";
             row.AddCell(ReplaceExcelEscapedCharsAndEscapeXmlOnes(cellContent.ToString()));
         }
     }
 }
Пример #4
0
        private static bool IsWysiwygFormattedColumn(SpreadsheetRow row, int index)
        {
            var key = row.Spreadsheet.Header.GetRow(0).GetCell(index).Content;

            return(!nonWysiwygColumns.Contains(key));
        }
Пример #5
0
 private static void ReadRow(ExcelWorksheet worksheet, int rowIndex, int colCount, SpreadsheetRow row)
 {
     for (var c = 0; c < colCount; c++)
     {
         var cellContent = worksheet.Cells[rowIndex + 1, c + 1].Value ?? "";
         row.AddCell(cellContent.ToString());
     }
 }