Monday, September 8, 2008

Creating User-Defined Function for Excel

Code:

using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Office.Excel.Server.Udf;

namespace ExcelSamples
{
[UdfClass]
public class MyFirstUDF
{
[UdfMethod]
public Int32 RandomNo()
{
Random r = new Random();
return (Int32)((r.NextDouble()*5)+1);
}
}
}
Article:
http://msdn.microsoft.com/en-us/library/bb428649.aspx
http://www.wrox.com/WileyCDA/Section/Excel-Services-User-Defined-Functions-UDFs-.id-305100.html

0 comments: