## Get the source code of HYPGEOMDIST() and use in C#

Java, C++, C#, Delphi, ??? - Using the UNO bridges

### HYPGEOMDIST function in Calc

How can use the Openoffice function "HYPGEOMDIST" into my asp.net web application referencing its .dll file or namespace.

Currently i am using the MS Office "Microsoft.Office.Interop.Excel.dll" for the same.

Vedha
Last edited by RoryOF on Thu Oct 31, 2013 9:55 am, edited 1 time in total.
Reason: Changed Subject, as a descriptive Subject helps get relevantreplies [RoryOF, Moderator]
Openoffice 4.0.1 and Windows 7
Vedha

Posts: 3
Joined: Thu Oct 31, 2013 8:06 am

### Re: HYPGEOMDIST function in Calc

Hi, and welcome to the forum.

AOO Help wrote:
`HYPGEOMDIST: Returns the hypergeometric distribution.Syntax:      HYPGEOMDIST(X; NSample; Successes; NPopulation)X:           the number of results achieved in the random sample.NSample:     the size of the random sample.Successes:   the number of possible results in the total population.NPopulation: the size of the total population.`

It will be far simpler to calculate the value directly than to call the Calc function from an external application. The calculation is easily done in a dozen lines in any decent programming language. I doubt if you can call the Calc function without installing large parts of the Open Office application. AOO is an integrated system; you can't install selected bits and pieces of it. Even if you install the whole suite, it will be more challenging to determine how to utilize the Calc function than it will be to do the calculation yourself.

Read about the Probability Mass Function (pmf) of the Hypergeometric distribution. In this reference N (population size) is the same as NPopulation above, K (number of success states in the population) is Successes above, n (number of draws) is NSample above, and k (number of successes) is X above. Read about binomial coefficients if you're not familiar with how to calculate them.

If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800 on MacOS 10.14.6.   The locale for any menus or Calc formulas in my posts is English (USA).

MrProgrammer
Moderator

Posts: 3893
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

### Get the source code of HYPGEOMDIST() and use in C#

Hi,

i have installed the AOO 4.0 in my system.
How to get an use the source code one of the statistical function HYPGEOMDIST() from AOO and use it in asp.net code?

vedha
Openoffice 4.0.1 and Windows 7
Vedha

Posts: 3
Joined: Thu Oct 31, 2013 8:06 am

### Re: Get the source code of HYPGEOMDIST() and use in C# (URGE

For such a question about source code, you should ask the dev mailing list.
AOO 4.1.7 on Xubuntu 19.10 and 4.1.5 on Windows 10 (with winPenPack port).

Hagar Delest
Moderator

Posts: 28622
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

### Re: Get the source code of HYPGEOMDIST() and use in C#

You can lookup the code in http://svn.apache.org/viewvc/openoffice/ or search with http://opengrok.adfinis-sygroup.org/
And the Wiki pages https://wiki.openoffice.org/wiki/Calc/I ... _Functions tell you, what files are all affected by Calc functions.

The function HYPERGEOMDIST() is in main/sc/source/core/tool/interpr3.cxx, the method ScInterpreter::ScHypGeomDist()
regina

Posts: 67
Joined: Sat Apr 05, 2008 4:55 pm

### Re: Get the source code of HYPGEOMDIST() and use in C#

Note that Vedha is multi-posting. This topic or the other should be locked to keep all the discussion in one place.
HYPGEOMDIST function in Calc
Mr. Programmer
AOO 4.1.7 Build 9800 on MacOS 10.14.6.   The locale for any menus or Calc formulas in my posts is English (USA).

MrProgrammer
Moderator

Posts: 3893
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA