Skip to content

Commit 13d0b8f

Browse files
committed
improvements in cell content gethering
1 parent b8aa12e commit 13d0b8f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/TableView.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ public string GetCellsContent(IEnumerable<TableViewCellSlot> slots, bool include
439439

440440
if (includeHeaders)
441441
{
442-
stringBuilder.AppendLine(GetHeadersContent(separator, minColumn, maxColumn));
442+
stringBuilder.Append(GetHeadersContent(separator, minColumn, maxColumn));
443+
stringBuilder.Append('\n');
443444
}
444445

445446
foreach (var row in slots.Select(x => x.Row).Distinct())
@@ -458,10 +459,12 @@ public string GetCellsContent(IEnumerable<TableViewCellSlot> slots, bool include
458459
stringBuilder.Append($"{column.GetCellContent(item)}{separator}");
459460
}
460461

461-
stringBuilder.Remove(stringBuilder.Length - 1, 1);
462+
stringBuilder.Remove(stringBuilder.Length - 1, 1); // remove extra separator at the end of the line
462463
stringBuilder.Append('\n');
463464
}
464465

466+
stringBuilder.Remove(stringBuilder.Length - 1, 1); // remove extra line at the end
467+
465468
return stringBuilder.ToString();
466469
}
467470

@@ -481,6 +484,8 @@ private string GetHeadersContent(char separator, int minColumn, int maxColumn)
481484
stringBuilder.Append($"{column.Header}{separator}");
482485
}
483486

487+
stringBuilder.Remove(stringBuilder.Length - 1, 1); // remove extra separator at the end of the line
488+
484489
return stringBuilder.ToString();
485490
}
486491

0 commit comments

Comments
 (0)