Cross-platform Generate xlsx Document

That would be the easy part. I was thinking about changing the html to include the javascript and css from linked files. That require a bit of parsing.

It’s called the scope operator.
And when it has no namespace preceding it, it refers to the toplevel ObjectSpace.

1 Like

Well a HEREDOC or a double quoted string can do it (using string interpolation.)

Within Ruby …

js_text =,"dialog.js"))
css_text =,"dialog.css"))

html = %[
<!DOCTYPE html>


Note that when we do this, all the code is loaded into the Ruby process’ memory.
When you let the CEF dialog load directly from html, js and css files, the code will be in the CEF instances memory (which happens anyway.)

Thanks for all your help. I’ll have to come back here for a refresher when I get ready to package my app.

There also is a standard templating library that can build your HTML text using <%= #Ruby code %> tags within the html.

It is sort of like how PHP is parsed on web servers.

and the internal comments in “erb.rb”.

The YARD documenter uses it to build the doc web pages. uses YARD.

Thanks again everyone for your all your help. The performance seems to be pretty good.


Yea, looks good!


Can you shed some light on the process? Perhaps an example or tutorial.
I’m about where you were 7 years ago when you posted this.

The solution lists several links. The one that looks the most useful is UnmanagedExports, but I really have no idea how to get all the parts and pieces working and use it in Ruby. (I would be willing to pay for a sample project or tutorial)

There are a few ways to use C# together with ruby, side by side.

  1. You can create a c# console application and compile to both a windows and an osx executable and execute those from Ruby and wait for their completions (see: You can pass arguments to the process, just like you can to an ordinary function. You could see this approach the same as contemporary lambdas used in webservices.
  2. Instead of an executable one can also compile C# into a library (dll on windows or dylib on osx) and export some functions (see: You can then use Fiddle ( to wrap the native library and call it from ruby.
  3. I have tried wrapping the coreclr as a ruby c++ extension once… did not make it.
  4. Windows only… and… pretty old tech: register you dll as a COM object and then call it using Win32OLE.


Back then I ended up crafting a COM object. The biggest disadvantage was that this was Windows only. But, on the other hand, one gained also power over things such as WPF… from ruby :slight_smile:

1 Like

A valuable book for adding Ruby bindings for a library is the book …
Extending Ruby 1.9: Writing Extensions in C
There’s a PDF link in the Ruby Resources downloadable book list.

Thanks Dan. I have done a few ruby c++ extensions, going from geometric calculations to running native HTTP and Websocket servers directly in SketchUp using native threads. But, wrapping the coreclr… that was a bit over the top of my head.