How to format cells in excel sheet programmatically?
Just set the appropriate property on your cell (Range) objects.
Set NumberFormat to control the cell number formatting, i.e.:
newSheet.Cells[i, j].NumberFormat = "m/d/yyyy"
Set HorizontalAlignment to control the alignment, i.e.:
newSheet.Cells[i, j].HorizontalAlignment = ExcelAlignment.xlLeft; //or Excel.XlHAlign.xlHAlignLeft