This project has moved and is read-only. For the latest updates, please go here.

Loading and Modifying Files

Loading a workbook created with ClosedXML:
            var workbook = new XLWorkbook("BasicTable.xlsx");


Modifying the workbook:
            var ws = workbook.Worksheet(1);

            // Change the background color of the headers
            var rngHeaders = ws.Range("B3:F3");
            rngHeaders.Style.Fill.BackgroundColor = XLColor.LightSalmon;

            // Change the date formats
            var rngDates = ws.Range("E4:E6");
            rngDates.Style.DateFormat.Format = "MM/dd/yyyy";

            // Change the income values to text
            var rngNumbers = ws.Range("F4:F6");
            foreach (var cell in rngNumbers.Cells())
                cell.DataType = XLCellValues.Text;
                cell.Value += " Dollars";


Saving the workbook:

Last edited Jan 24, 2011 at 12:26 AM by MDeLeon, version 8