Populating InfoPath repeating section with C# programmatically and keeping formulas

There’s lots of tutorials showing how to programmatically fill in a repeating section or table in infopath using C#. However I only found one that shows how to do this without losing formulas, formatting and validation on the controls.

The process is to clone the first row in the repeating table instead of creating new ones.

Link here: http://sharepoint.orcinus-orca.eu/archives/17