本文整理匯總了C#中OfficeOpenXml.ExcelPackage.AddWorksheet方法的典型用法代碼示例。如果您正苦於以下問題:C# ExcelPackage.AddWorksheet方法的具體用法?C# ExcelPackage.AddWorksheet怎麽用?C# ExcelPackage.AddWorksheet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OfficeOpenXml.ExcelPackage
的用法示例。
在下文中一共展示了ExcelPackage.AddWorksheet方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateNewFile
/// <summary>
/// Creates an Excel Workbook from a DataSet
/// </summary>
/// <param name="sqlResults">The DataSet to populate a workbook with. The TableName of each DataTable will be the header and Tab name of each sheet.</param>
/// <param name="title">The Title of the workbook</param>
/// <returns></returns>
public static ExcelPackage CreateNewFile( DataSet sqlResults = null, string title = null )
{
var excel = new ExcelPackage();
excel.Workbook.Properties.Title = title;
excel.Workbook.Properties.Author = UserLoginService.GetCurrentUser()?.Person?.FullName ?? "Rock";
// Create the worksheet(s)
foreach ( DataTable data in sqlResults.Tables )
{
excel.AddWorksheet( data );
}
return excel;
}