Spread WF, #REF trying to copy/clone sheet

Posted by: epena on 30 August 2021, 12:45 am EST

  • Posted 30 August 2021, 12:45 am EST

    Having two spreads, spread1 with desired sheets to copy, spread2 the one about to receive a copied/cloned sheets version from spread1, the sheets contains defined names, the spread2 control shows #REF on formulas using defined names or referencing other sheets. If spread2 is saved as .xls the references work fine in Excel and all defined names are there & working. spread1 shows correctly…

    Tried this code:

    
            public void CopySheetsToThis(F1BookHelper bookToAttach)
            {
                int thisSheetIndex = base.ActiveSheetIndex;
    
                try
                {
                    base.Sheets.RemoveAt(base.ActiveSheetIndex);
                    foreach (SheetView sheet in bookToAttach.Sheets)
                        //base.Sheets.Add(CopySheet(sheet));
                        base.Sheets.Add(sheet.Clone());
                }
                catch (Exception ex) { throw; }
                finally
                {
                    this.ActiveSheetIndex = thisSheetIndex;
                }
            }
    
    

    Also tried this code:

    http://helpcentral.componentone.com/NetHelp/SpreadNet6/WF/spwin-sheetcopy.html

  • Posted 30 August 2021, 10:57 pm EST

    Hi,

    We do not see this issue at our end. Please refer to the sample attached. Could you please share a sample replicating the issue, so that we can investigate this at our end?

    Regards

    Avnish

    SpreadFromula1.zip

  • Posted 2 September 2021, 1:00 am EST

    Hi Avnish,

    I’ve attached back the code sample you sent me and a capture of the #REF errors I’m getting.

    Changes I did:

    -In VS Designer, on fpSpread1 → Spread Designer

    Go to Sheet2:

    -Cell $B$2: Add a define name (myDefineName).

    -Cell $B$4: Set value 7 then added a define name (mySeven).

    Go to Sheet1:

    -Cell $B$6: Set formula ‘=myDefineName3’

    -Cell $B$8: Set formula '=mySeven
    3’

    On startup fpspread does have the calculations done, when Copy is clicked, fpSpread2 shows the #REF.

    I’m missing something with the copy procedure?

    Regards

    Eduardo

    SpreadFromula1.zip

  • Posted 2 September 2021, 3:15 pm EST

    Hi,

    We have reported this issue to the development team and will let you know when we have an update.

    Regards

    Avnish

    [Internal Tracking Id: SPNET-20211]

  • Posted 3 September 2021, 12:56 am EST

    Hi Avnish,

    Thanks for reply, is there any estimation of time before we have any news of the issue, or at least a minimum wait time for development team to take the case?

    Regards

    Eduardo

  • Posted 5 September 2021, 4:34 pm EST

    Hi Eduardo,

    As per the development team, When the sheet view is added to spread, the spread will invoke the LoadFormula, so you need to use the BeginInit/EndInit to suspend/resume the load formula at the end. So that the formulas are loaded when all the sheets are copied.

    Please refer to the sample attached.

    Regards

    Avnish

    SpreadFromula1_nod.zip

  • Posted 6 September 2021, 4:22 am EST

    Hi Avnish,

    I’ve tested the Begin/EndInit as the example, so far so good.

    Thanks for the help.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels