Ejemplo n.º 1
0
 public WorkSheetDfn(string sheetName, RowDfn header, string nullValStr = "-")
 {
     Name         = sheetName;
     Header       = header;
     NullValStr   = nullValStr;
     BufferedRows = new List <RowDfn>();
 }
Ejemplo n.º 2
0
        internal string ToXmlString(int rowNumber, RowDfn header, string nullValSymbol = "-")
        {
            var row = new StringBuilder();

            if (Cells == null || !Cells.Any())
            {
                return(row.ToString());
            }

            row.Append($"<row r=\"{rowNumber}\" spans=\"{1}:{header.Cells.Count}\">");
            try
            {
                for (var columnNumber = 0; columnNumber < header.Cells.Count; columnNumber++)
                {
                    var headerCell = header.Cells[columnNumber];
                    var cell       = Cells.FirstOrDefault(s => s.ColumnHeaderName == headerCell.ColumnHeaderName) ??
                                     new CellDfn(headerCell.ColumnHeaderName, nullValSymbol);

                    row.Append(cell.ToXmlString(rowNumber, columnNumber + 1, nullValSymbol));
                }
            }
            finally
            {
                row.Append("</row>");
            }

            return(row.ToString());
        }