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