I attach a test file (Test.mrt).
It has a German Culture set to it and a {Time} field displayed.
I load this with this code:
Code: Select all
@section JS{
@Html.Stimulsoft().RenderMvcViewerScripts()
}
@Html.Stimulsoft().StiMvcViewer(
"Reports",
new StiMvcViewerOptions()
{
Controller = "List",
ActionGetReportSnapshot = "GetReportSnapshot?r=" + r,
ActionViewerEvent = "ViewerEvent?r=" + r,
ActionExportReport = "ExportReport?r=" + r,
ActionPrintReport = "PrintReport?r=" + r,
//ServerCacheMode = StiCacheMode.Page,
Width = Unit.Percentage(100),
Height = Unit.Pixel(1300),
ClientRequestTimeout = 900000,
Theme = StiTheme.Office2007Silver,
ScrollbarsMode = true,
//CountColumnsParameters = 4,
ShowButtonParameters = true,
BackColor = Color.DarkGray,
MenuShowMode = StiShowMenuMode.Click,
MenuViewMode = StiWebViewMode.OnePage,
MenuAnimation = false,
ShowButtonBookmarks = false,
//ActionDesignReport = "",
//ShowButtonDesign = true,
}
)
public ActionResult GetReportSnapshot(ListModel model)
{
using(var report = GetReport(model))
{
return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
}
}
public ActionResult ViewerEvent(ListModel model)
{
using (var report = GetReport(model))
{
return StiMvcViewer.ViewerEventResult(HttpContext, report);
}
}
private StiReport GetReport(ListModel model)
{
var r = HttpContext.Request.QueryString["r"];
if (string.IsNullOrWhiteSpace(r))
{
var docs = model.GetDocsStimulSoft();
var newDocs = docs.Select(x => new
{
// Fill in the properties...
});
var report = new StiReport();
report.Load(MrtFilePath);
report.RegBusinessObject("Document", "Document", newDocs.ToList());
return report;
}
else
{
string mrtFile = HttpUtility.UrlDecode(r, Encoding.UTF8);
mrtFile = Path.Combine(ReportsDir, mrtFile + ".mrt");
var report = new StiReport();
report.Load(mrtFile);
SetReportParameters(report);
return report;
}
}
void SetReportParameters(StiReport report)
{
ChangeConenctionString(report);
report.RequestParameters = true;
var vars = report.Dictionary.Variables;
var ident = IoC.GetInstance<IIdentityContext>();
report["usrID"] = ident.UserId;
report["grpID"] = ident.CurrentGroupId;
report["FromDate"] = DateTime.Now.AddYears(-1);
report["ToDate"] = DateTime.Now;
}
void ChangeConenctionString(StiReport report)
{
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new StiSqlDatabase("Connection", "Connection", "connection string", false));
}
My Windows is in English but the default thread culture is Greek (I guess this is due to "Region and Language" settings).
When I view the report with the code presented above, I see the {Time} field in Greek (21/11/2013 10:10:12 πμ).
-------------------------------
Nope. "Save As" doesn't help either.
I attach my MRT file (SOS_Report 4.mrt).