Tuesday, 15 September 2015

How do I Change the Sheet Name from C# on an Excel Spreadsheet -


I have C # applications where I am creating several Excel files from the database in the database, though this part is working fine , My user asked if the sheet tab can be modified to display the field from the database. It sounds simple, however, when I try to reset the name, it tells me that it is read only and can not be set. I have tried the following and it is not working:

  xlApp.Sheets [0]. ["A1"]. Value = "newtname"; Also try:  
  xlApp.Name = "NewTabName";  

I saw a Google search and some other methods that were not working for me and some reactions indicate that it is only readable and can not be done .

Something looks like that should be simple. How can i do it

You need access to the actual worksheet. Try doing something like this:

  Microsoft.Office.Interop.Excel.Worksheet worksheet = (worksheet) xlApp.Worksheets ["Sheet1"]; Worksheet Name = "newtname";  

1 comment:

  1. पैनल c # प्रोग्राम में बटन डालें
    Insert Button to a Panel

    ReplyDelete