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

Free Support Forum - aspose.com

[Bug] Aspose Cell Copy Sheet to the other workbook - hidden cells disappear

Hi,
The following is my code for insert source sheet to target sheet…

    public void InsertSingleWorksheet(string sourceWorkbookPath, string sourceSheetName)
    {
        Workbook sourceWorkbook = new Workbook(sourceWorkbookPath);
        var sourceSheet = sourceWorkbook.Worksheets[sourceSheetName];

        var newwSheetId = workbook.Worksheets.Add();
        var newSheet = workbook.Worksheets[newwSheetId];
        newSheet.Name = sourceSheetName;
        newSheet.Copy(sourceSheet);
    }

the original look like that… you can see rows are hidden after 34, and columns are hidden after R.
image.png (8.7 KB)

However, after processing CopySheet to other work book… the row become unbidden. Columns are still hidden… We believe it is the bugs in Aspose. can you please handle this?

image.png (23.3 KB)

you can also let me know how to hide ALL the rows after certain row as a workaround? (with on performance issue)

@catalparue26,

Thanks for the code segment and screenshots.

Please provide your source file to evaluate your issue precisely. We will check it soon.

PS. please zip the file prior attaching.

Hi, please see the zip file with excel.
CopyExample.zip (24.2 KB)

@catalparue26,

Thanks for the template file containing those sheets.

Please try our latest version/fix: Aspose.Cells for .NET v20.2.3 (attached)

Your issue should be fixed in it. I have tested using your sample code with your template file and it works fine.

Let us know your feedback.
Aspose.Cells20.2.3 For .Net2_AuthenticodeSigned.Zip (5.2 MB)
Aspose.Cells20.2.3 For .Net4.0.Zip (5.2 MB)

Hi, I download this version… Aspose.Cells20.2.3 For .Net4.0.Zip… it doesn’t work. Hidden cell still disappear… Please see the attachment as the result.
image.png (39.3 KB)

@catalparue26,

Please make sure that you are using Aspose.Cells for .NET v20.2.3, you may print the version number at the start for confirmation, e.g
Console.WriteLine(CellsHelper.GetVersion());

I used the following sample code with your template file using v20.2.3. I have also attached the output file which is ok when I opened into MS Excel 2007/2013:
e.g
Sample code:

    Workbook sourceWorkbook = new Workbook("e:\\test2\\CopyExample.xlsx");
                var sourceSheet = sourceWorkbook.Worksheets[1];

                Workbook workbook = new Workbook();
                var newwSheetId = workbook.Worksheets.Add();
                var newSheet = workbook.Worksheets[newwSheetId];

                newSheet.Name = sourceSheet.Name;
                newSheet.Copy(sourceSheet);

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

I have also attached the screenshot of the copied sheet taken in MS Excel:
files1.zip (8.0 KB)
sc_shot1.png (74.2 KB)

The issue still exist in 20.2.3. You can reproduce it by insert a new sheet into “existing workbook” not “new workbook”.
Sample code as follow…

    static void Main(string[] args)
    {

        Workbook sourceWorkbook = new Workbook("c:\\test\\CopyExample.xlsx");
        var sourceSheet = sourceWorkbook.Worksheets[1];


        var workbook = new Workbook("C:\\test\\TargetSheet.xlsx");
        var newwSheetId = workbook.Worksheets.Add();
        var newSheet = workbook.Worksheets[newwSheetId];

        newSheet.Name = "insertedSheet";
        newSheet.Copy(sourceSheet);

        workbook.Save("c:\\test\\newsheet.xlsx");
    }

TargetSheet.zip (29.6 KB)

@catalparue26,
We are analyzing the scenario and will share our feedback soon.

@catalparue26,

Thanks for the template file(s).

After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template files. I found by copying sheet(s) to other workbook, the hidden rows are not retained, the hidden rows are disappeared in the copied sheet. It works fine if we use new (blank) destination workbook (as per my previous code/test I shared). I have logged a ticket with an id “CELLSNET-47213” for your issue. We will look into it soon.

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

thanks. Can you let me know when this version will be available? We are currently holding Aspose Cell Standard license.

@catalparue26,

As we just logged a ticket, so kindly spare us little time to analyze your issue in details. If the issue is not complex, you should be getting the fix before the end of next week or so. If it is a complex issue, then it might take 2/3 weeks or more time.

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

great! thanks for the update!

@catalparue26,
You are welcome.

@catalparue26,

Please try our latest version/fix: Aspose.Cells for .NET v20.2.4 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.2.4 For .Net2_AuthenticodeSigned.Zip (5.2 MB)
Aspose.Cells20.2.4 For .Net4.0.Zip (5.2 MB)
Aspose.Cells20.2.4 For .NetStandard20.Zip (4.4 MB)

thanks! it works great! when can we have this on nuget package?

@catalparue26,

Good to know that your issue is sorted out in the new fix/version. We are scheduled to publish our next official release of the product (e.g Aspose.Cells for .NET v20.3) on Downloads/nuget repos. in the third/fourth week of March 2020. This new release will also include your fix.
You will also be notified in the thread once the next official release is published.

The issues you have found earlier (filed as CELLSNET-47213) have been fixed in Aspose.Cells for .NET v20.3. This message was posted using Bugs notification tool by Amjad_Sahi