private static void FirstTest() { var myExcel = new Excel(new ExcelOptions { Filename = "TestExcel", Visible = true, WorksheetName = "My Work" }); // For logging purpose Console.WriteLine($"Excel build: {myExcel.Version}"); myExcel.WriteCellValue(1, 1, "This is the name column"); myExcel.WriteCellValue(1, 2, "This should go in B1; quick brown fox"); myExcel.WriteCellValue(3, 2, "should be in b3"); myExcel.WriteCellValue(3, 3, "good gracious great balls of fire!!!"); // Number myExcel.WriteCellValue(3, 4, 12345.7890); myExcel.FormatCell(3, 4, "$ #,##0.00", false); // Date myExcel.WriteCellValue(3, 5, DateTime.Today); myExcel.FormatCell(3, 5, "dd-MMM-yyyy", false); myExcel.FormatCell(3, 6, string.Empty, true); //custom format var format = "[Red][<0]$ -#,##0.00; [Black][>0]$ #,##0.00"; myExcel.WriteCellValue(4, 6, -345.346); myExcel.FormatCell(4, 6, format, false); myExcel.WriteCellValue(5, 6, 34545.346); myExcel.FormatCell(5, 6, format, false); myExcel.AutofitColumn(1); myExcel.AutofitColumn(2); myExcel.AutofitColumn(3); for (int i = 1; i < 21; i++) { myExcel.WriteCellValue(i, 7, new Random().Next()); } myExcel.AutofitColumn(7); myExcel.SetEntireColumnFormat(7, "$ #,##0.00"); myExcel.SetEntireColumnStyle(7, "Currency"); myExcel.SaveAndQuit(); }