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.

Tue Oct 10, 2023 6:58 pm

Hi, I am looking to buy Spire.XLS and trying to test couple of usecase and come across issue of image overlap when merged excels. I have attached sample and outcome. is there a way to resolve it?

Code: Select all
//Create a string array from Excel file paths
using Spire.Xls;

string[] inputFiles = new string[] { @"L:\Excel\Set 1\Set 1\SET2.xlsx", @"L:\Excel\Set 1\Set 1\SET1.xlsx" };

//Initialize a new Workbook object
Workbook newWorkbook = new Workbook();
//Clear the default worksheets
newWorkbook.Worksheets.Clear();

//Initialize another temporary Workbook object
Workbook tempWorkbook = new Workbook();

//Loop through the string array
foreach (string file in inputFiles)
{
    //Load the current workbook
    tempWorkbook.LoadFromFile(file);
    //Loop through the worksheets in the current workbook
    foreach (Worksheet sheet in tempWorkbook.Worksheets)
    {
        //Copy each worksheet from the current workbook to the new workbook
        newWorkbook.Worksheets.AddCopy(sheet, WorksheetCopyType.None);
    }
}

//Save the new workbook to file
newWorkbook.SaveToFile("L:\\Excel\\Set 1\\Set 1\\MergeWorkbooks.xlsx", ExcelVersion.Version2016);



Source/Outcome : Image
Attachments
Source Image 01.png
Source Image 01.png (749.36 KiB) Viewed 1660 times
Outcome.zip
Outcome
(1.55 MiB) Downloaded 564 times
Source.zip
Source
(1.57 MiB) Downloaded 544 times

kmpschroders
 
Posts: 3
Joined: Tue Oct 10, 2023 6:41 pm

Wed Oct 11, 2023 2:38 am

Hi,

Thanks for your feedback.
After testing, I have reproduced this issue and logged it into our issue tracking system with the ticket number SPIREXLS-4930, our dev team will investigate and fix it, we apologize for any inconvenience caused, once the issue is fixed, I will inform you asap.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Wed Oct 11, 2023 1:15 pm

Triste.Dai wrote:Hi,

Thanks for your feedback.
After testing, I have reproduced this issue and logged it into our issue tracking system with the ticket number SPIREXLS-4930, our dev team will investigate and fix it, we apologize for any inconvenience caused, once the issue is fixed, I will inform you asap.

Best regards,
Triste
E-iceblue support team


Do we know any timeline for it?

kmpschroders
 
Posts: 3
Joined: Tue Oct 10, 2023 6:41 pm

Thu Oct 12, 2023 1:33 am

Hi,

Thanks for your inquiry.
This issue needs to be investigated by our developers, and we are currently unable to provide an accurate timeline. Please be assured that we have assigned this matter the highest priority. once the issue is fixed, I will inform you asap.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Tue Oct 17, 2023 6:31 am

Hi,

Thanks for your feedback.
After reviewing your case, our dev team has identified that the discrepancy is due to the workbook theme not being copied over properly.

To resolve this issue, we kindly request that you make the following modification to your code:
Code: Select all
//Loop through the string array
foreach (string file in inputFiles)
{
    //Load the current workbook
    tempWorkbook.LoadFromFile(file);
    if(file.EndsWith("SET2.xlsx"))
    {
        newWorkbook.CopyTheme(tempWorkbook);
    }
    //Loop through the worksheets in the current workbook
    foreach (Worksheet sheet in tempWorkbook.Worksheets)
    {
        //Copy each worksheet from the current workbook to the new workbook
        newWorkbook.Worksheets.AddCopy(sheet, WorksheetCopyType.None);
    }
    tempWorkbook.Dispose();
}


By ensuring that the workbook theme is correctly copied, you should be able to generate the resulting document with the desired consistency and appearance.

If you encounter any further difficulties or require additional assistance, please don't hesitate to reach out to us.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Wed Nov 01, 2023 2:24 pm

Thanks for reply, it does not solve issue, if we have mulitple files with theme and if we copy only theme of first one, it is not formatting correctly other excel worksheet in merged files

kmpschroders
 
Posts: 3
Joined: Tue Oct 10, 2023 6:41 pm

Thu Nov 02, 2023 8:05 am

Hi,

Thanks for your reply.
There is currently no better solution available, we apologize for any inconvenience caused. If you have any other questions, just feel free to contact us. We are here to assist you.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.XLS