private void RenderColorScheme() { ColorSchemeStylesheet stylesheet = new ColorSchemeStylesheet(); //this.Page.Header.Controls.AddAt(2, stylesheet); //this.Page.Header.Controls.Add(stylesheet); phColorScheme.Controls.Add(stylesheet); }
protected void lnkLeftPanelSectionExport_Click(object sender, EventArgs e) { // Get the full path of the current session's report definition file. string fileName = HttpContext.Current.Session["ReportDefinition"].ToString(); // Create a new report definition by the file. ReportDefinition reportDefinition = new ReportDefinition( Global.Core, fileName, Global.HierarchyFilters[fileName] ); DisplayType displayType = reportDefinition.Settings.DisplayType; reportDefinition.Settings.DisplayType = DisplayType.Crosstable; reportDefinition.Save(); Crosstables.Classes.Crosstable crosstable = new Crosstables.Classes.Crosstable( Global.Core, fileName ); crosstable.IsExport = true; //crosstable.AsynchRender = true; crosstable.Render(); ColorSchemeStylesheet colorScheme = new ColorSchemeStylesheet(); colorScheme.Render(); StringBuilder style = new StringBuilder(); style.Append("<style type=\"text/css\">"); style.Append(colorScheme.InnerHtml.Split(new string[] { "##### Scroll bar styles #####" }, StringSplitOptions.None)[0]); style.Append(File.ReadAllText(Path.Combine( Request.PhysicalApplicationPath, "Stylesheets", "Modules", "Crosstables.css" ))); style.Append("</style>"); Crosstables.Classes.Exporter exporter = new Crosstables.Classes.Exporter( crosstable.Table, style.ToString(), reportDefinition ); reportDefinition.Settings.DisplayType = displayType; reportDefinition.Save(); string fName = exporter.Export(); base.WriteFileToResponse(fName, "Export.xlsx", "application/msexcel", true); }