ID

Uploaded

Status

Description

Work Items

Action

7274
by francisdurairaj
Nov 5, 2010
7:27 AM

Being evaluated

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;
}
}

Download

View All
  • 1-1 of 1 Patches
    • Previous
    • 1
    • Next
    • Showing
    • All
    • Patches