Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Dec 20, 2021 3:28 pm

Hi there,

Recently taken over support for a site using your free XLS DLLs.
We've recently updated to the latest update available to fix an issue with images as we found advised on here also. Which fixed our issue, brilliant!

However, we're also looking to modify a Worksheet we have by the name of "Booking form" but cannot for the life of us find where we can edit this!
It's the default and we're not adding it ourselves from what I can see via the code, could you perhaps point us in the right direction where this is located or modified?

Code: Select all
                           using (ExcelPackage xlPackage = new ExcelPackage(newFile, template))
                           {
                              ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets["Booking form"];


The ExcelPackage seems to have the worksheet built in to it and the project's previous developers must've done this.

We essentially want to add a new one to replace "Booking Form" so it fits the new file and the new template created but it'd also be good to know where to edit the existing worksheet.
Any ideas?

Best regards,
Last edited by allan.sloan on Tue Dec 21, 2021 1:33 pm, edited 1 time in total.

allan.sloan
 
Posts: 3
Joined: Tue May 24, 2016 2:40 pm

Tue Dec 21, 2021 3:40 am

Hello,

Thank you for your inquiry.
When using our Spire.XLS, please use the following code to get the existing worksheet named "Booking Form" and then edit it. If my understanding is wrong, please share us with your original Excel file as well as your desired output effect for reference, then we will look into it and guide you accordingly.
Code: Select all
//Create a workbook and load a file
Workbook workbook = new Workbook();
workbook.LoadFromFile(inputFile);
//Get the worksheet named "Booking form" from the workbook
Worksheet worksheet = workbook. Worksheets["Booking form"];
...
//Save the document
workbook. SaveToFile(resultFile, FileFormat.Version2013);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Tue Dec 21, 2021 1:32 pm

Hi Annika,

Thanks for your response.

It's a complete misunderstanding from our part. We had assumed that a preset was being set within Spire.XLS somewhere.

It's all handled within our excel document. We had a new Workbook created but we stubboringly reused an existing workbook and didn't rename the worksheet hence the "Booking Form" causing the confusion here as it didn't match the new files created.

Our issues are resolved. Thanks!

allan.sloan
 
Posts: 3
Joined: Tue May 24, 2016 2:40 pm

Wed Dec 22, 2021 12:59 am

Hello,

Glad to hear that your issue has been solved.
If you have other questions about using Spire.XLS in the future, please feel free to contact us.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1647
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS