/// ----------------------------------------------------------------------------------------------- /// <summary> /// Exports a basic grouped dataset that with four levels of drill-down; Directors, Managers /// Team Leads & Associates /// With this example there are User-Defined Columns for every dataset. /// Saved to a file on C drive. /// </summary> /// <param name="sender">object</param> /// <param name="e">EventArgs</param> /// ----------------------------------------------------------------------------------------------- protected void btnStyledRelatedGroupedDataSetToFile_Click(object sender, EventArgs e) { try { // Target path & filename var savePath = @"C:\\SpreadsheetLightWorkbook.xls"; var dataSet = _mocks.CreateRelatedGroupedDataSet(); Exporter.OutputWorkbook( null, dataSet, new[] { "Custom Grouped DS" }, CustomExcelExportStyles.SetupCustomStyles(), true, savePath); } catch (Exception ex) { Log.Error("SpreadsheetLightWrapper.Web.Default.btnStyledRelatedGroupedDataSetToFile_Click -> " + ex.Message + ": " + ex); } }
/// ----------------------------------------------------------------------------------------------- /// <summary> /// This example has four tables with three that are related, Directors, Managers & TeamLeads. /// The unrelated table Associates will get its own sheet, the three related will be grouped /// on one sheet. /// </summary> /// <param name="sender">object</param> /// <param name="e">EventArgs</param> /// ----------------------------------------------------------------------------------------------- protected void btnPartiallyRelatedGroupedDataVer3_Click(object sender, EventArgs e) { try { var dataSet = _mocks.CreatePartiallyRelatedGroupedDataSetVer3(); Response.Clear(); Response.ContentType = "application/excel"; Response.AddHeader("Content-disposition", "filename=ExcelExport.xlsx"); Exporter.OutputWorkbook( Response.OutputStream, dataSet, new[] { "Dir-Manag-TLs", "Associates" }, CustomExcelExportStyles.SetupCustomStyles()); Response.OutputStream.Flush(); Response.OutputStream.Close(); Response.Flush(); Response.Close(); } catch (Exception ex) { Log.Error("SpreadsheetLightWrapper.Web.Default.btnPartiallyRelatedGroupedDataVer3_Click -> " + ex.Message + ": " + ex); } }
/// ----------------------------------------------------------------------------------------------- /// <summary> /// This example has User-defined columns and Customized Settings. The User-Defined columns /// set the column order, custom column names, visibility and data formatting. /// It has four tables Directors, Managers, TeamLeads & Associates that are unrelated and /// each gets its own sheet in the Workbook /// </summary> /// <param name="sender">object</param> /// <param name="e">EventArgs</param> /// ----------------------------------------------------------------------------------------------- protected void btnUngroupedNoParentChildData_Click(object sender, EventArgs e) { try { var dataSet = _mocks.CreateUnrelatedUngroupedDataSet(); Response.Clear(); Response.ContentType = "application/excel"; Response.AddHeader("Content-disposition", "filename=ExcelExport.xlsx"); Exporter.OutputWorkbook( Response.OutputStream, dataSet, null, CustomExcelExportStyles.SetupCustomStyles()); Response.OutputStream.Flush(); Response.OutputStream.Close(); Response.Flush(); Response.Close(); } catch (Exception ex) { Log.Error("SpreadsheetLightWrapper.Web.Default.btnUngroupedNoParentChildData_Click -> " + ex.Message + ": " + ex); } }