I have successfully exported a datatable to an excel sheet ... In this excel sheet I have to display the columns (customerid, Productname, referenceno) of the data table except the last column .... now how can I display the data table in excel without displaying the last column (referenceno) ...
will someone tell me a solution to this problem .. Thanks in Advance ..
here is my datatable export code for excel:
System.Data.DataTable dt = clsobj.convert_datagrid_orderlist_to_datatable(dvgorderlist, txtreferenceno); oxl = new Excel.Application(); oxl.Visible = true; oxl.DisplayAlerts = false; wbook = oxl.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); oxl.ActiveCell.set_Item(2, 4, "Alfa Aesar"); wsheet = (Excel.Worksheet)wbook.ActiveSheet; wsheet.Name = "Customers"; Excel.Range range = wsheet.get_Range("A6", "H6"); wsheet.get_Range("A6", "H6").Font.Name = "Times new Roman"; wsheet.get_Range("A6", "H6").Font.Size = 12; wsheet.get_Range("A6", "H6").Interior.Color = ConvertColour(Color.SkyBlue); oxl.ActiveWindow.DisplayGridlines = false; int rowCount = 5; foreach (DataRow dr in dt.Rows) { rowCount += 1; for (int i = 1; i < dt.Columns.Count + 1; i++) {
source share