/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable"/> of a specified type contained in <see cref="excelOutputItem"/>into Excel. If the specified type is a complex type, /// all properties and fields are exported into columns. If the specified type is a simple type, the data is exported into a /// single column. /// </summary> /// <param name="excelOutputItem">An object containing all the necessary parameters to create an Excel export into a single worksheet.</param> public static void ToExcel(this ExcelOutputItem excelOutputItem) { var excelOutputCollection = new ExcelOutputCollection(excelOutputItem.PostCreationActions, excelOutputItem.Path) { excelOutputItem, }; excelOutputCollection.ToExcel(); }
/// <summary> /// Instantiate an instance of the ExcelOutputItem with a particular <see cref="IEnumerable"/> collection. /// This object allows for the creation of a single sheet, or when used in conjunction with <see cref="ExcelOutputCollection"/>, /// the creation of multiple sheets within a single Workbook. /// <param name="enumerable">An enumerable of type <param name="type"/> which contains data to be exported to Excel.</param> /// <param name="type">A type which is contained within the IEnumerable.</param> /// <param name="worksheetName">The name given to the newly generated worksheet.</param> /// <param name="trim">A parameter which determines whether strings should be trimmed before being written to Excel.</param> /// <param name="postCreationAction">Determines whether the Excel file will be opened with the data, opened and saved or just saved.</param> /// <param name="path">If the path parameter determines where the Excel file will be saved to if a save action is selected from the <see cref="PostCreationActions"/>.</param> /// </summary> public static ExcelOutputItem CreateInstance(IEnumerable enumerable, Type type, string worksheetName, bool trim, PostCreationActions postCreationAction, string path) { var excelOutputItem = new ExcelOutputItem { Enumerable = enumerable, Type = type, WorksheetName = worksheetName, Trim = trim, PostCreationActions = postCreationAction, Path = path, }; return(excelOutputItem); }
/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable{T}"/> into Excel. If <see cref="T"/> is a complex type, /// all properties and fields are exported into columns. If <see cref="T"/> is a simple type, the data is exported into a /// single column. /// </summary> /// <typeparam name="T">A generic type which is contained within the IEnumerable.</typeparam> /// <param name="input">An <see cref="IEnumerable{T}"/> which will be evaluated, expanded and exported into Excel.</param> /// <param name="postCreationAction">Determines whether the Excel file will be opened with the data, opened and saved or just saved.</param> /// <param name="path">If the path parameter determines where the Excel file will be saved to if a save action is selected from the <see cref="PostCreationActions"/>.</param> public static void ToExcel <T>(this IEnumerable <T> input, PostCreationActions postCreationAction, string path) { ExcelOutputItem.CreateInstance(input, postCreationAction, path).ToExcel(); }
/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable"/> of type <see cref="type"/> into Excel. If <see cref="type"/> is a complex type, /// all properties and fields are exported into columns. If <see cref="type"/> is a simple type, the data is exported into a /// single column. /// </summary> /// <param name="input">An <see cref="IEnumerable"/> which will be evaluated, expanded and exported into Excel.</param> /// <param name="type">The type of the objects contained within the IEnumerable in <see cref="input"/>.</param> /// <param name="worksheetName">The name given to the newly generated worksheet.</param> public static void ToExcel(this IEnumerable input, Type type, string worksheetName) { ExcelOutputItem.CreateInstance(input, type, worksheetName).ToExcel(); }
/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable{T}"/> into Excel and opens Excel to display the exported data. /// If <see cref="T"/> is a complex type, all properties and fields are exported into columns. If <see cref="T"/> is a simple type, /// the data is exported into a single column. /// </summary> /// <typeparam name="T">A generic type which is contained within the IEnumerable.</typeparam> /// <param name="input">An <see cref="IEnumerable{T}"/> which will be evaluated, expanded and exported into Excel.</param> /// <param name="worksheetName">The name given to the newly generated worksheet.</param> public static void ToExcel <T>(this IEnumerable <T> input, string worksheetName) { ExcelOutputItem.CreateInstance(input, worksheetName).ToExcel(); }
/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable"/> of type <see cref="type"/> into Excel. If <see cref="type"/> is a complex type, /// all properties and fields are exported into columns. If <see cref="type"/> is a simple type, the data is exported into a /// single column. /// </summary> /// <param name="input">An <see cref="IEnumerable"/> which will be evaluated, expanded and exported into Excel.</param> /// <param name="type">The type of the objects contained within the IEnumerable in <see cref="input"/>.</param> /// <param name="trim">A parameter which determines whether strings should be trimmed before being written to Excel.</param> public static void ToExcel(IEnumerable input, Type type, bool trim) { ExcelOutputItem.CreateInstance(input, type, trim).ToExcel(); }
/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable{T}"/> into Excel and opens Excel to display the exported data. /// If <see cref="T"/> is a complex type, all properties and fields are exported into columns. If <see cref="T"/> is a simple type, /// the data is exported into a single column. /// </summary> /// <typeparam name="T">A generic type which is contained within the IEnumerable.</typeparam> /// <param name="input">An <see cref="IEnumerable{T}"/> which will be evaluated, expanded and exported into Excel.</param> /// <param name="trim">A parameter which determines whether strings should be trimmed before being written to Excel.</param> public static void ToExcel <T>(this IEnumerable <T> input, bool trim) { ExcelOutputItem.CreateInstance(input, trim).ToExcel(); }
/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable"/> of type <see cref="type"/> into Excel. If <see cref="type"/> is a complex type, /// all properties and fields are exported into columns. If <see cref="type"/> is a simple type, the data is exported into a /// single column. /// </summary> /// <param name="input">An <see cref="IEnumerable"/> which will be evaluated, expanded and exported into Excel.</param> /// <param name="type">The type of the objects contained within the IEnumerable in <see cref="input"/>.</param> /// <param name="trim">A parameter which determines whether strings should be trimmed before being written to Excel.</param> /// <param name="postCreationAction">Determines whether the Excel file will be opened with the data, opened and saved or just saved.</param> /// <param name="path">If the path parameter determines where the Excel file will be saved to if a save action is selected from the <see cref="PostCreationActions"/>.</param> /// <param name="worksheetName">The name given to the newly generated worksheet.</param> public static void ToExcel(IEnumerable input, Type type, string worksheetName, bool trim, PostCreationActions postCreationAction, string path) { ExcelOutputItem.CreateInstance(input, type, worksheetName, trim, postCreationAction, path).ToExcel(); }
/// <summary> /// Evaluates, expands and exports an <see cref="IEnumerable{T}"/> into Excel. If <see cref="T"/> is a complex type, /// all properties and fields are exported into columns. If <see cref="T"/> is a simple type, the data is exported into a /// single column. /// </summary> /// <typeparam name="T">A generic type which is contained within the IEnumerable.</typeparam> /// <param name="input">An <see cref="IEnumerable{T}"/> which will be evaluated, expanded and exported into Excel.</param> /// <param name="trim">A parameter which determines whether strings should be trimmed before being written to Excel.</param> /// <param name="postCreationAction">Determines whether the Excel file will be opened with the data, opened and saved or just saved.</param> /// <param name="path">If the path parameter determines where the Excel file will be saved to if a save action is selected from the <see cref="PostCreationActions"/>.</param> /// <param name="worksheetName">The name given to the newly generated worksheet.</param> public static void ToExcel <T>(this IEnumerable <T> input, string worksheetName, bool trim, PostCreationActions postCreationAction, string path) { ExcelOutputItem.CreateInstance(input, worksheetName, trim, postCreationAction, path).ToExcel(); }