We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Formatting of worksheet changed after workbook.combine()

Here is the snippet I am trying to execute:

        FinalDocument = new Workbook();
        for (int i = 0; i < FinalDocument.Worksheets.Count; i++)
        {
            FinalDocument.Worksheets.RemoveAt(i);
        }
        var fileList = WorksheetNames.Select(w => w.Value).Distinct().ToList();
        foreach (var file in fileList)
        {
            Workbook wb = new Workbook(_pitchSharedLocation + "\\" + file);

            if (wb.HasExernalLinks())
            {
                wb.RemoveExternalLinks();
            }
            FinalDocument.Combine(wb):
        }
        List<string> notNeeded = new List<string>();
        foreach (Worksheet sheet in FinalDocument.Worksheets)
        {
            if (!WorksheetNames.Keys.Contains(sheet.Name))
            {
                notNeeded.Add(sheet.Name);
            }
        }
        
        foreach (string name in notNeeded)
        {
            FinalDocument.Worksheets.RemoveAt(name);
        }

        FinalDocument.Save(_pitchSharedLocation + "\\" + _finalDocumentName);

I have also attached the sample workbooks I am trying to merge (wb1.xlsx and wb2.xlsx), and the merged output (Document.xlsx). As you can see, the formatting of the output changes. Just compare SM sheet of wb1 and SM sheet of Document.xlsx. The black borders of the cells have changed to yellow, and the row width has also changed for row 5. Please tell me how to avoid this.

10.zip (803.5 KB)

Hi,

Thanks for the template files and output document.

After an initial test, I am able to observe the issue as you mentioned by using the following sample code with your template files. I found that formatting of a worksheet is changed after Workbook.Combine(). I did confirm the issue while comparing “SM” sheet of wb1 and “SM” sheet of Document.xlsx. The black borders of the cells have changed to yellow, and the row width has also changed for row 5.
e.g
Sample code:

   var FinalDocument = new Workbook();
            for (int i = 0; i < FinalDocument.Worksheets.Count; i++)
            {
                FinalDocument.Worksheets.RemoveAt(i);
            }

             List<string> paths = new List<string> { @"e:\test2\wb1.xlsx", @"e:\test2\wb2.xlsx" };

            foreach (var excelPath in paths)
            {
                if (excelPath != null && File.Exists(excelPath))
                {

                    Workbook wb = new Workbook(excelPath);

                    if (wb.HasExernalLinks())
                    {
                        wb.RemoveExternalLinks();
                    }

                    FinalDocument.Combine(wb);
                    
                }
            }
                         
            List<string> notNeeded = new List<string>();
            notNeeded.Add("a");
            notNeeded.Add("Sheet2");
            notNeeded.Add("2");

        
            foreach (string name in notNeeded)
            {
                FinalDocument.Worksheets.RemoveAt(name);
            }

            FinalDocument.Save("e:\\test2\\out1.xlsx");

I have logged a ticket with an id “CELLSNET-45453” for your issue. We will look into it to figure it out soon.

Once we have an update on it, we will let you know here.

Thank you.

Also please note the purple border on row 33, of the sheet SM of the combined workbook

Hi,

Thanks for providing further findings.

Yes, I have logged your findings against your issue into our database. Our concerned developer from product team will also consider fixing this when resolving your issue.

Thank you.

When can we expect a fix for this? We are working on a critical project and need this feature. Please resolve this issue ASAP.

Hi,

I am afraid, your issue is not resolved yet. I have asked the concerned developer from product team to update on your issue or provide an ETA (if possible).

Once we have any new information, we will share it with you here.

Thank you.

Please let me know if there is an update on the issue, or provide an ETA. As I said before this is a very critical project and a quick fix would be highly appreciated.

@viraniaman4,

We are pleased to inform you that your issue is sorted out now. We will soon provide you the fix (hopefully in the next few (2-5) days or so) after performing QA and incorporating other enhancements and fixes.

Keep in touch.

Thank you.

@viraniaman4,

Please try our latest version/fix: Aspose.Cells for .NET v17.6.2:
Aspose.Cells17.6.2 For .Net2_AuthenticodeSigned.zip (4.1 MB)
Aspose.Cells17.6.2.0 For .Net4.0.Zip (4.0 MB)

Your issue should be fixed in it.

Let us know your feedback.

Also, let us know if you were not able to download the attachments.

Thank you.

For both the files I see this message when I try to download them

Sorry, this file is private. Only visible to post creator and staff members

Could you try it again now.

Let us know how it goes.

Still getting the same message. Even cleared the browser cookies and cache.

@viraniaman4,

We are sorry for your inconvenience.

Please use the following links to download the attachments now:


Let us know if you still have any issue.

Thank you.

Unfortunately we cannot access dropbox from our internal network. Please change the file extension from .dll to something else, and email it to me at aman.virani@citi.com

@viraniaman4,

An email with attachments is sent @ your mentioned email id.

Thanks,

Thank you for the email. One final question on this thread: Is this version (17.6.2) suitable for a production environment?

@viraniaman,

Yes, v17.6.2 can be used on production server. It has all the functionality (full fledged) of official release, i.e., Aspose.Cells for .NET v17.6 with fixes and enhancements till this fix. Generally, we publish fixes for the users on forums for their issues and requirements, so they don’t have to wait much. However, our next official release Aspose.Cells for .NET v17.7 (which will also include the functionality of this fix) is due in the third or fourth week of July, 2017. You will also be notified in this thread once we publish our next official release.

Thank you.

The issues you have found earlier (filed as CELLSNET-45453) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

The issues you have found earlier (filed as CELLSNET-45453) have been fixed in this update.