DefaultSheetDataModel.ClearData

Posted by: arq2002 on 10 March 2019, 10:47 pm EST

  • Posted 10 March 2019, 10:47 pm EST

    I’ve upgraded from v8 to v12. I use this for only Clear data and not formula, but since version 11 it clears both data and formula.

    How to clear data only?

  • Posted 11 March 2019, 6:13 pm EST

    Hello,

    From Spread for WinForms version 11, calling DefaultSheetDataModel.ClearData() method will now also clear Formula of cells in the range along with the data because we cannot clear cell value if the formula existed.

    This is the breaking change and it is mentioned in ReadMe link here as well:-

    https://help.grapecity.com/spread/SpreadNET12ReadMe/webframe.html#DataModel.html

    Hope it clarifies.

    Thanks,

    Reeva

  • Posted 13 March 2019, 9:48 pm EST

    I know, but in my scenario I have got excel with many rows without formula (my input data) and many rows with formula (my calculated output data).

    My excel has columns for 24 hours, and I have to iterate throughout the year day by day.

    In v8 that was simple, first I clear data, next fill rows with input data (one day), then recalculate, then get values from calculated cells and store to data base. Next get input data for another day, clear excel, fill rows ,… , …, etc

    I need extra fast function for clear data only!

    My workaroud is now:

    DefaultSheetDataModel sheetDataModel = fpSpread.ActiveSheet.Models.Data as DefaultSheetDataModel;

    if (sheetDataModel != null)

    for (int r = 1; r < fpSpread.ActiveSheet.Rows.Count; r++)

    for (int c = 2; c < 26; c++)

    if (sheetDataModel.GetFormula(r, c) == “”)

    sheetDataModel.SetValue(r, c, null);

    but this is too slow :frowning:

    please help

  • Posted 14 March 2019, 5:16 pm EST

    Hello,

    We have escalated your request to the concerned team for further investigation and we will get back to you as soon as we hear anything from them.

    Tracking id for your issue is #270754

    However, in the meantime, instead of using DefaultSheetDataModel.Clear, you could try using SheetView.ClearRange() method.

    http://help.grapecity.com/spread/SpreadNet12/WF/webframe.html#FarPoint.Win.Spread~FarPoint.Win.Spread.SheetView~ClearRange(Int32,Int32,Int32,Int32,Boolean).html

    Thanks,

    Reeva

Need extra support?

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

Learn More

Forum Channels