Custom DateCellType and copy to clipboard

Posted by: pauld on 17 April 2018, 10:45 am EST

    • Post Options:
    • Link

    Posted 17 April 2018, 10:45 am EST

    I have a custom date celltype but I am trying to implement a very picky requirement and I don’t know how to do it.

    When the user clicks a button we use ClipboardCopy() to copy the entire spread.

    But, if the value in this custom date celltype is “1/1/1900”, we want a blank value copied instead of the “1/1/1900”.

    I am overriding the “Format()” function in my custom celltype return an empty string when the incoming object value is “1/1/1900”.

    However, this blanks out the date in the Spread too, but we want to see the “1/1/1900” in the grid. It’s only when we copy the spread data that we want the date to be copied as a blank string.

    Can this be done?

    Thanks.

    – Paul

  • Posted 17 April 2018, 10:03 pm EST

    Hello,

    You tried the following thing to replace the date with the blank string:

    
      fpSpread1_Sheet1.ClipboardCopy(range);
                    Clipboard.SetText(Clipboard.GetText().Replace("1/1/1900", ""));
    
    

    Hope it helps.

    Thanks,

    Mohit

  • Posted 18 April 2018, 2:36 am EST

    Esha,

    A brilliantly simple solution.

    Thanks.

    – Paul

Need extra support?

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

Learn More

Forum Channels