Recently I saw someone asked in a forum, how to add a digital clock in Excel. It is a interesting question, and I thought it is easy to make one by Spread WPF-Silverlight / Spread WinRT. Just for fun, I opened the Spread Designer... Only few steps: Adjust cells layout and set appearance for digital clock Define display pattern for each digit, and give a custom name "DigitPattern" to left-top cell of the pattern area Use formula to get digits of time


=LEFT(TEXT(HOUR(NOW()),"00"))  

Used formula to get display pattern of each digit


=OFFSET(DigitPattern,ROW()-ROW(B2),COLUMN()-COLUMN(B2)+A1*3)  

Used Conditional Format to show each digit Finally load this document into Spread Control in IDE, and add several lines of code to make the clock live.


public MainPage()  
{  
    this.InitializeComponent();  
    DispatcherTimer dt = new DispatcherTimer();  
    dt.Interval = TimeSpan.FromSeconds(1);  
    dt.Tick += (sender, e) => { if (this.gcSpreadSheet1.ActiveSheet != null) this.gcSpreadSheet1.ActiveSheet.Recalculate(); };  
    dt.Start();  
}  

Run the application, you will see the digital clock Here is Spread WPF sample code, you can try to create Silverlight and WinRT projects and use the spread document directly. For more information of products, please visit Spread WPF-Silverlight and Spread WinRT on our web site.