private void writeTableData(Section collection) { var activeCells = collection.GetActiveCells(); var lengths = activeCells.Select(x => widthOfColumn(collection, x)).ToArray(); var header = "|"; for (int i = 0; i < activeCells.Length; i++) { header += activeCells[i].PadRight(lengths[i]) + "|"; } write(header); foreach (var step in collection.Children.OfType <Step>()) { var line = "|"; for (int i = 0; i < activeCells.Length; i++) { var key = activeCells[i]; var value = step.Values.ContainsKey(key) ? step.Values[key].Replace("|", PipebarEscape) : string.Empty; line += value.PadRight(lengths[i]) + "|"; } write(line); } }
private void writeTableData(Section collection) { var activeCells = collection.GetActiveCells(); var lengths = activeCells.Select(x => widthOfColumn(collection, x)).ToArray(); var header = "|"; for (int i = 0; i < activeCells.Length; i++) { header += activeCells[i].PadRight(lengths[i]) + "|"; } write(header); foreach (var step in collection.Children.OfType<Step>()) { var line = "|"; for (int i = 0; i < activeCells.Length; i++) { var key = activeCells[i]; var value = step.Values.ContainsKey(key) ? step.Values[key].Replace("|", PipebarEscape) : string.Empty; line += value.PadRight(lengths[i]) + "|"; } write(line); } }