Skip to content

Commit 18dfaa2

Browse files
committed
Write cell format to output
1 parent 761fb07 commit 18dfaa2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/Program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,19 @@ static void PrintLastEditedBy(ExcelWorkbook workbook, TextWriter output)
5858
static void PrintSheetContent(ExcelWorksheet sheet, TextWriter output)
5959
{
6060
output.WriteLine("=================================");
61-
output.WriteLine("Sheet: " + sheet.Name + "[ " + sheet.RowCount() + " , " + sheet.ColumnCount() + " ]");
61+
output.WriteLine($"Sheet: {sheet.Name} [ {sheet.RowCount()} , {sheet.ColumnCount()} ]");
6262
output.WriteLine("=================================");
6363

6464
for (int row = 1; row < sheet.RowCount() + 1; row++)
6565
{
6666
for (int column = 1; column < sheet.ColumnCount() + 1; column++)
6767
{
6868
var cell = sheet.Cells[row, column];
69-
if (!string.IsNullOrEmpty(cell.Text))
69+
var cellText = cell.Text;
70+
var cellFormula = cell.Formula;
71+
if (!string.IsNullOrEmpty(cellText) || !string.IsNullOrEmpty(cellFormula))
7072
{
71-
output.WriteLine(" " + cell.Address + ": " + cell.Text);
73+
output.WriteLine($" {cell.Address}: {cellText} {cellFormula}");
7274
}
7375
}
7476
}

0 commit comments

Comments
 (0)