Skip to content

Instantly share code, notes, and snippets.

View govert's full-sized avatar

Govert van Drimmelen govert

  • Excel-DNA
  • Johannesburg, South Africa
View GitHub Profile
@govert
govert / ObservableClock.cs
Last active December 1, 2017 22:06
Test code for Excel-DNA IExcelObservable
using System;
using System.Diagnostics;
using System.Threading;
using ExcelDna.Integration;
namespace TestDisposable
{
public static class RtdClock
{
[ExcelFunction(Description = "Provides a ticking clock")]
@govert
govert / RTD DisconnectData array issue.md
Last active December 12, 2018 14:14
RTD calls made from an array formula do not disconnect properly

Overview

The issue concerns the behaviour of Excel's RTD feature when:

  • the RTD call is made from a wrapper function,
  • the wrapper function is called from an array formula, and
  • in one of the calculation calls, the wrapper function does not make an RTD call.

The expected behaviour is that the RTD server gets a DisconnectData call for the relevant RTD topic.

The observed behaviour is that the RTD server does not get a DisconnectData call.

@govert
govert / Test.vb
Created August 20, 2019 09:57
VB.NET Test for Google Groups question
Option Explicit On
Imports ExcelDna.Integration ' for ExcelDnaUtil, XlCall, etc
Imports System.Math
Imports System.Runtime.InteropServices ' for <ComVisible(True)>
Imports ExcelDna.Integration.CustomUI ' needed for IRibbonControl
Imports DNAIRibbonControl = ExcelDna.Integration.CustomUI.IRibbonControl ' needed for IRibbonControl
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Excel ' Các giao diện như Workbook, Range
Module Globals
@govert
govert / SetValuePerf.cs
Last active July 2, 2020 20:45
Excel-DNA: Test ExcelReference.SetValue performance
using System;
using System.Diagnostics;
using ExcelDna.Integration;
using static ExcelDna.Integration.XlCall;
namespace SetValuePerf
{
public static class Macros
{
@govert
govert / FastChannel.cs
Created September 19, 2020 21:38 — forked from Manuel-S/FastChannel.cs
Fast Shared Memory Remoting by Joseph Albahari
using System.Threading.Tasks;
using System.IO.MemoryMappedFiles;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
async Task Main()
{
using (var channel = DemoServer())
@govert
govert / gist:1378887
Created November 19, 2011 14:29
Excel-DNA Dynamic Code from string
<DnaLibrary Name="ExcelDna Test Dynamic Method" Language="C#">
<Reference Name="System.Windows.Forms" />
<![CDATA[
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using Microsoft.CSharp;
@govert
govert / AsyncBatchExample.cs
Last active September 5, 2023 16:36
Async Batching Sample
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Timer = System.Timers.Timer;
using ExcelDna.Integration;
namespace ExcelDnaSamples
{
@govert
govert / GpsUtils.cs
Last active March 25, 2024 08:43
Convert WGS-84 geodetic locations (GPS readings) to Cartesian coordinates in a local tangent plane (Geodetic to ECEF to ENU)
using System;
using System.Diagnostics;
using static System.Math;
// Some helpers for converting GPS readings from the WGS84 geodetic system to a local North-East-Up cartesian axis.
// The implementation here is according to the paper:
// "Conversion of Geodetic coordinates to the Local Tangent Plane" Version 2.01.
// "The basic reference for this paper is J.Farrell & M.Barth 'The Global Positioning System & Inertial Navigation'"
// Also helpful is Wikipedia: http://en.wikipedia.org/wiki/Geodetic_datum