We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Sheet Name

Hi, everybody.

I am trying to customize an application for export data to Excel.

One of the customizations I need to do is to change the default sheet name "Sheet1" to another name, using the following sentence:

     exportSettings.SheetName = "TestExport"

But when Lightswitch tries to execute the export, i get an error message indicating that this sheet does not exists.

Also, I've tried to create the sheet using 

     exportSettings.Worksheet.Application.Worksheets.Create("TestExport")

and remove the default sheet using

     exportSettings.Worksheet.Application.Worksheets.Remove("Sheet1")

without success.

Please, I need help on this matter.

And I´ll be glad if you post some documentation on exportSettings.Worksheet functionality.

Thank you
Osvaldo


3 Replies

KD Kesavan D Syncfusion Team June 21, 2016 12:04 PM UTC

Hi Osvaldo, 

Thank you for contacting Syncfusion support. 

Please find the detailed response for your queries. 
I need to do is to change the default sheet name "Sheet1" to another name, using the following sentence: 
 
     exportSettings.SheetName = "TestExport" 

SheetName property is similar to ActiveSheet(i.e) only existing sheet name can be assigned to “ExcelExportOptions.SheetName”. 

You can rename the worksheet by using the following code snippet 
 
exportSettings.Worksheet.Application.Worksheets["Sheet1"].Name = "TestExport"; 


We have created sample to illustrate the above code snippet which is available for download in the following link. 


Please try this sample and let us know if your requirement is fulfilled. 


I've tried to create the sheet using  
 
     exportSettings.Worksheet.Application.Worksheets.Create("TestExport") 
 
and remove the default sheet using 
 
     exportSettings.Worksheet.Application.Worksheets.Remove("Sheet1") 
 
without success. 

We are unable to reproduce this issue in our end. The expected behavior of adding a new sheet and removing existing is working fine. If you still face this issue, we request you to share the issue reproducing sample which will be helpful for us to provide you a solution to you at the earliest.  
 I´ll be glad if you post some documentation on exportSettings.Worksheet functionality. 
ExcelExportOptions is a custom helper class used for exporting in our BookStoreApplication. Currently, we don’t have a documentation for the custom classes. You can make of these class in your project and let us know if you need any clarification in it. 


Regards, 
Kesavan 



OD Osvaldo Djivelekian June 27, 2016 02:37 AM UTC

Hi Kesavan

Thank you for your response.

I have tested both options and now are working fine.

Thank you very much for your help.

Regards,
Osvaldo




KD Kesavan D Syncfusion Team June 27, 2016 04:34 AM UTC

Hi Osvaldo, 

We are glad to know that your requirement is fulfilled. 

Please let us know if you need any further assistance on this. 

Regards, 
Kesavan 


Loader.
Live Chat Icon For mobile
Up arrow icon