Interop Excel
-
I am using interop for creating excel .. i ve cretaed the excel file. Now i need to hide or delete some of the columns.... Can u plz tell me the code for that... Thanks in Regardss....
-
I am using interop for creating excel .. i ve cretaed the excel file. Now i need to hide or delete some of the columns.... Can u plz tell me the code for that... Thanks in Regardss....
Just use the Excel object model!!!! To hide column A in the active worksheet, you can use this:
ActiveSheet.Cells(, 1).EntireColumn.Hidden = True
To delete it, use this:
ActiveSheet.Cells(, 1).EntireColumn.Delete
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
-
I am using interop for creating excel .. i ve cretaed the excel file. Now i need to hide or delete some of the columns.... Can u plz tell me the code for that... Thanks in Regardss....
Hi, If you are building enterprise application you shouldn't use Excel Interop. Check out GemBox.Spreadsheet .NET Excel component for reading and writing XLS, XLSX, ODS, CSV and HTML files. Here is an example how to hide or delete column:
ExcelFile ef = new ExcelFile();
// Loads Excel file.
ef.LoadXls("filename.xls");// Selects first worksheet.
ExcelWorksheet ws = ef.Worksheets[0];// Hides first column.
ws.Columns[0].Hidden = true;//Deletes second column.
ws.Columns[1].Delete();