BN089-BS开发框架MVC4版/source20131023/Zephyr.Net/Zephyr.Core/Exporter/XlsxExport.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*************************************************************************
* 文件名称 :XlsxExport.cs
* 描述说明 :导出EXCEL2007
*
* 创建信息 : create by liuhuisheng.xm@gmail.com on 2012-11-10
* 修订信息 : modify by (person) on (date) for (reason)
*
* 版权信息 : Copyright (c) 2013 厦门纵云信息科技有限公司 www.zoewin.com
**************************************************************************/
using System;
using System.Drawing;
using System.IO;
using Zephyr.Utils;
using Zephyr.Utils.EPPlus;
using Zephyr.Utils.EPPlus.Style;
namespace Zephyr.Core
{
public class XlsxExport:IExport
{
public string suffix { get {return "xlsx"; } }
private ExcelPackage package;
private ExcelWorksheet sheet;
public void Init(object data)
{
package = new ExcelPackage();
sheet = package.Workbook.Worksheets.Add("sheet1");
}
public void MergeCell(int x1,int y1,int x2,int y2)
{
sheet.Cells[y1+1, x1+1, y2+1, x2+1].Merge = true;
}
public virtual void FillData(int x, int y,string field, object value)
{
if (ZGeneric.IsTypeIgoreNullable<DateTime>(value))
sheet.Cells[y + 1, x + 1].Style.Numberformat.Format = "yyyy-MM-dd hh:mm:ss";
sheet.Cells[y + 1, x + 1].Value = value;
}
public virtual void SetHeadStyle(int x1, int y1, int x2, int y2)
{
using (var head = sheet.Cells[y1 + 1, x1 + 1, y2 + 1, x2 + 1]) // set head style
{
head.Style.Font.Bold = true;
head.Style.Font.Size = 12;
head.Style.Font.Name = "Arial";
head.Style.Border.Top.Style = ExcelBorderStyle.Thin;
head.Style.Border.Top.Color.SetColor(Color.Gray);
head.Style.Border.Right.Style = ExcelBorderStyle.Thin;
head.Style.Border.Right.Color.SetColor(Color.Gray);
head.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
head.Style.Border.Bottom.Color.SetColor(Color.Gray);
head.Style.Border.Left.Style = ExcelBorderStyle.Thin;
head.Style.Border.Left.Color.SetColor(Color.Gray);
后面还有 37 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。