Excel-DNA and CHM Help Files generated from Sandcastle

May 28, 2013 at 10:14 AM
Hi everyone,

I am generating a CHM file with Sandcastle Help File Builder, based on a csproj file. What I'm ultimately trying to do, is to find the TopicID of each topic in the CHM file, and use them with Excel-Dna like so:

[ExcelFunction(Category = "MyCategory", Name = "MyUDF", HelpTopic="MyHelp.chm!102")]
Even though I know all the URLs for the articles in the CHM file -- I can see the contents with 7zip and HTML Help Workshop (HHW) -- I don't know how to use Sandcastle or HHW to map the topics to certain ids or to find out the ids of the topics I already have.

Any thoughts?


May 28, 2013 at 10:31 AM
Hi Christos,

If the HelpTopic does not have a full path, Excel-DNA will put the path to the .xll in front, and then pass the string to Excel's xlfRegister function. So Excel is interpreting the HelpTopic string. Recent Excel versions can also take a url, though I don't know whether only "http" is supported, or whether you can somehow specify a link into a .chm file that way.

Maybe you could make a small help file using some other tool where you have control of the TopicID, and then see if you can hook things up.

I think Keith Lewis has figured out how to generate and hook up SandCastle help with Excel in his "xll" library (it's similar to Excel-DNA but for native C++). His project is hosted here: https://xll.codeplex.com/ It's clearly a hairy story to implement.

If you're still stuck, I can have a look too, though it's not a feature I've used myself.
If you figure it out, please post back too!

May 28, 2013 at 4:11 PM
Hello Govert,

I went ahead and created a CHM file with Doxygen, and manually added the [MAP] and [ALIAS] fields in the HPP file in HTML Help Workshop. I've mapped a specific html to the number 1000, so now when I use "MyHelp.chm!1000", it actually opens the right html inside the chm file.
Hence I think it's an issue with Sandcastle not doing the mapping and the aliasing for use with Excel-Dna. I don't want to do this roundabout way, as I was planning on adding this as a build event on the TFS we use.
Do you think there's any other way?

I've tried to do this:


But none of them seem to be able to point into the CHM file.

Any thoughts?
May 29, 2013 at 10:19 AM
Hi Christos,

I suspect you'll have to find a way to generate the MAP and ALIAS fields in some way.

No easy answer, I'm afraid...

May 29, 2013 at 10:55 AM
I think you're right Govert.
I'll need to take this up with Sandcastle.

Thanks for your time :)