1
Vote

Just a fix for web and Windows Applcation access

description

Exporter need to change in code for web and windows application. So its better to determine the type of application accessing it and access the template.
Add reference System.Web; to ExportDLL and declare a Property setter as follows.
public static bool IsWebApplication
    {
        get
        {
            try
            {
                System.Web.HttpContext Context = System.Web.HttpContext.Current;
                if (Context != null)
                    return true;
            }
            catch { }
 
            return false;
        }
    }
 
and in the StringTemplateGroup Check the application is web and set the Server.MapPath for PathFiles
private static StringTemplateGroup stgCollection
    {
        get
        {
            string where = @"templates\Collection";
            if (IsWebApplication)
                PathFiles = System.Web.HttpContext.Current.Server.MapPath("bin");

            if (!string.IsNullOrEmpty(PathFiles))
            {
                where = Path.Combine(PathFiles, where);
            }
            StringTemplateGroup stg = new StringTemplateGroup("Collection", where);
            stg.RegisterAttributeRenderer(typeof(string), new AdvancedStringRenderer());
            stg.RegisterAttributeRenderer(typeof(DateTime), new AdvancedDateTimeRenderer());
            return stg;
        }
    }

file attachments

comments