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.

Wed Nov 01, 2023 2:31 am

Hi Spire,

I found that there is an error when copying certain shape created using Microsoft Excel 365, for example Freeform. It will convert the shape into a "text". Attached is the excel file for your testing.

Thanks in advanced for helping to find out.
Attachments
freeform not viewable after using CopyFrom.zip
(45.47 KiB) Downloaded 880 times

mshyan_spire
 
Posts: 15
Joined: Tue Jul 12, 2022 2:50 am

Wed Nov 01, 2023 5:53 am

Hi,

Thank you for your inquiry.
I used the following code to test your scenario and encounter the similiar issue as you. Did you use the same code as me?
Code: Select all
// Create a new Workbook object
Workbook workbook = new Workbook();

// Load the workbook from the specified file path
workbook.LoadFromFile(@"E:\\35012\\freeform not viewable after using CopyFrom\\freeform not viewable after using CopyFrom.xlsx");

// Get the first worksheet in the workbook
Worksheet sheet1 = workbook.Worksheets[0];

// Add a new worksheet to the workbook and name it "Copy"
Worksheet sheet2 = workbook.Worksheets.Add("Copy");

// Copy the content of sheet1 to sheet2
sheet2.CopyFrom(sheet1);

// Save the modified workbook to the specified output file path
workbook.SaveToFile(@"E:\\35012\\result.xlsx");

If not, please offer your full test code that can reproduce your issue to help us do further investigation, you can attach here or send it to us via email ([email protected]). Thank you in advance.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Wed Nov 01, 2023 7:12 am

Hi Ula, my code is similar with yours:
Code: Select all
  Workbook workbook = new Workbook();
            workbook.LoadFromFile("C:\\Users\\user\\Downloads\\freeform not viewable after using CopyFrom.xlsx");
            Workbook wb1 = new Workbook();
            wb1.Worksheets[0].CopyFrom(workbook.Worksheets[0]);
            wb1.Worksheets[2].Remove();
            wb1.Worksheets[1].Remove();
            wb1.SaveToFile("C:\\Users\\user\\Downloads\\freeform not viewable after using CopyFrom result.xlsx", ExcelVersion.Version2016);

And for your info, I tested another function (AddCopy) also having same issue:

Code: Select all
  Workbook workbook = new Workbook();
            workbook.LoadFromFile("C:\\Users\\user\\Downloads\\freeform not viewable after using CopyFrom.xlsx");
            Workbook wb1 = new Workbook();
            wb1.Worksheets.Clear();
                        foreach (Worksheet s in workbook.Worksheets)
                        {
                            //Copy each worksheet from the current workbook to the new workbook
                            wb1.Worksheets.AddCopy(s, WorksheetCopyType.CopyAll);
                        }

mshyan_spire
 
Posts: 15
Joined: Tue Jul 12, 2022 2:50 am

Wed Nov 01, 2023 7:50 am

Hi,

Thank you for your feedback.
I have tested the code you provided and reproduced your issue. I have recorded this issue in our bug tracking system with the number "SPIREXLS-4963". Our development team will investigate and fix it in the future. If this issue is resolved, we will notify you as soon as possible. We deeply apologize for the inconvenience caused.

Sincerely
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Fri Nov 24, 2023 10:16 am

Hi,

Thank you for your patience.
I'm glad to inform you that we just released Spire.Xls 13.11.4 has resolved your issue with SPIREXLS-4963. Welcome to download the test.
Website download link: https://www.e-iceblue.com/Download/download-excel-for-net-now.html

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Return to Spire.XLS