Showing posts from August, 2013

How to get windows.external to work when using Awesomium.NET – Take 2

I got asked to provide the code from my post on How to get windows.external to work when using Awesomium.NET. Since I don’t have it (I don’t know why, but it’s gone…). I decided to create a new example, post it on this repo at github and hopefully don't loose it anymore ;).

I’m assuming you are familiar with Awesomium.NET and just can’t figure out how to get windows.external at work (which is a must have on embedded web browser controls). I’m not going to show you what is Awesomium or how to use it, there’s a lot of good tutorials on the official site and it has no sense I retype that here. So, enough jibber jabber, let’s go to the code.

First of all, be sure you setup the right platform prior to compile the code (Last time I checked Awesomium.NET only works on x86).

If you download the sample code, you will find this html file within the solution. 

The whole point of _external.html_click is to marshall the function call from javascript to c#. In order to do that, you have to “reg…

How to replace text with images on Word documents using C#

This post it’s a reply to a question I got from a previous post that shows how to work with Word templates from C# code. If you haven’t read it, I recommend to do so because I’m not going into details here. But basically it was about how to create a Word document from a template and perform same text manipulation.
So, the question from Marcel Kieboom was
“Do you know if it would be also possible to replace one of the words with an image which is locally stored?”
The answer is yes, and this is how you can do that.

Based on the same convention I had used in the previous post, I should have a template like this:

What I’m trying to do here is replace the text [angus-young] for an actual pic of Angus. The technique I’m using it’s pretty common on web sites and basically consist in have an image with a matching name for each keyword I want to replace and then create the image path dynamically.
This is the C# code to do that.

* When I execute the find operation I’m using the flag WdReplace…