Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. Interop Excel

Interop Excel

Scheduled Pinned Locked Moved COM
com
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mithun narayanan
    wrote on last edited by
    #1

    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....

    S G 2 Replies Last reply
    0
    • M mithun narayanan

      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....

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • M mithun narayanan

        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....

        G Offline
        G Offline
        gg4237
        wrote on last edited by
        #3

        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();

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups