In last week's tip on using the NVelocity template formatting engine, I described what to set to load a template from an absolute path.
Here's the magic necessary to get NVelocity to load a template from an embedded resource:
VelocityEngine engine = new VelocityEngine(); ExtendedProperties properties = new ExtendedProperties(); properties.AddProperty("resource.loader", "assembly"); properties.AddProperty("assembly.resource.loader.class", "NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader, NVelocity"); properties.AddProperty("assembly.resource.loader.assembly", "StencilFormatter"); engine.Init(properties);
Page rendered at Thursday, November 20, 2008 8:54:39 AM (Pacific Standard Time, UTC-08:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
E-mail