当前位置: 首页>>代码示例>>C#>>正文


C# Workbook.getBytes方法代码示例

本文整理汇总了C#中Workbook.getBytes方法的典型用法代码示例。如果您正苦于以下问题:C# Workbook.getBytes方法的具体用法?C# Workbook.getBytes怎么用?C# Workbook.getBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Workbook的用法示例。


在下文中一共展示了Workbook.getBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportOperateLogWithExcel

        public ActionResult ExportOperateLogWithExcel()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = new Worksheet("Sheet1");

            var list = db.T_ZC_MemberLog.ToList();
            foreach (var log in list)
            {
                ExcelGenerator.SpreadSheet.Row row = new ExcelGenerator.SpreadSheet.Row();

                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.ID.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.StartDateTime.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.EndDateTime.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.Message.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(Enum.GetName(typeof(OperateTypes),log.OperateType)));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(Enum.GetName(typeof(GenerateSystem),log.GenerateModule)));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.MemberID.ToString()));

                worksheet.Rows.Add(row);
            }
            workbook.Worksheets.Add(worksheet);
            return new ExcelResult(workbook.getBytes(), "Export.xls");
        }
开发者ID:SLSoft,项目名称:GGZBTQPT,代码行数:23,代码来源:ZC_MemberLogController.cs

示例2: ExportErrorLogWithExcel

        public ActionResult ExportErrorLogWithExcel()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = new Worksheet("错误日志");

            var list = db.T_ZC_CommonLog.Where(l => l.Level == "Error").ToList();
            foreach( var log in list)
            {
                ExcelGenerator.SpreadSheet.Row row = new ExcelGenerator.SpreadSheet.Row();

                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.ID.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.Level.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.Logger.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.Message.ToString()));
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.Source.ToString()));
                if(log.Exception.Length <= 500)
                {
                    row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.Exception.ToString()));
                }
                else
                {
                    row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.Exception.Substring(0, 500)));
                }
                row.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(log.User.ToString()));

                worksheet.Rows.Add(row);
            }
            workbook.Worksheets.Add(worksheet);
            return new ExcelResult(workbook.getBytes(), "Export.xls");
        }
开发者ID:SLSoft,项目名称:GGZBTQPT,代码行数:30,代码来源:ZC_CommonLogController.cs

示例3: GetXLS

        //returns an XLS Stream
        public static byte[] GetXLS(IList<IList<string>> table)
        {
            //Create a workbook
            Workbook workbook = new Workbook();

            //Create a worksheet
            Worksheet worksheet = new Worksheet("Report");

            //Create a new row
            foreach (var row in table)
            {
                 var xlsRow = new ExcelGenerator.SpreadSheet.Row();
                 foreach (var col in row)
                 {
                     xlsRow.Cells.Add(new ExcelGenerator.SpreadSheet.Cell(col));
                 }
                 worksheet.Rows.Add(xlsRow);
            }

            //Add worksheet to Workbook
            workbook.Worksheets.Add(worksheet);

            return workbook.getBytes();
        }
开发者ID:sysev,项目名称:project-iceberg,代码行数:25,代码来源:ExportResultHelper.cs


注:本文中的Workbook.getBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。