EPPlus生成Excel表格(只支持2007及以上)
主要来源:
博客: https://www.cnblogs.com/rumeng/p/3785748.html
官网: http://epplus.codeplex.com/
教程: https://riptutorial.com/zh-CN/epplus/topic/8070/%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8epplus
FileInfo newFile = new FileInfo(@"F:\mynewfile.xlsx");
using (ExcelPackage xlPackage = new ExcelPackage(newFile))//如果mynewfile.xlsx存在,就打开它,否则就在该位置上创建
{
ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets.Add("Tinned Goods");
worksheet.Cells[, ].Value = "Product";
worksheet.Cells[, ].Value = "Broad Beans";
worksheet.Cells[, ].Value = "String Beans";
worksheet.Cells[, ].Value = "Peas";
worksheet.Cells[, ].Value = "Total"; worksheet.Cells[, ].Value = "Tins Sold";//给单元格赋值 ExcelRange cell = worksheet.Cells[, ];
cell.Value = ;//另一种方式给单元格赋值 string calcStartAddress = cell.Address; worksheet.Cells[, ].Value = ;
worksheet.Cells[, ].Value = ; string calcEndAddress = worksheet.Cells[, ].Address; worksheet.Cells[, ].Formula = string.Format("SUM({0}:{1})", calcStartAddress, calcEndAddress);//使用公式计算值,并赋值给单元格 worksheet.Column().Width = ;//设置列宽 xlPackage.Workbook.Properties.Title = "Sample 1";//设置excel的一些属性
xlPackage.Workbook.Properties.Author = "John Tunnicliffe";
xlPackage.Workbook.Properties.SetCustomPropertyValue("EmployeeID", ""); xlPackage.Save();//保存Excel表格
简单使用(单元格赋值、使用公式等)
using (ExcelPackage pck = new ExcelPackage())
{
//Create the worksheet
ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Demo"); //Load the datatable into the sheet, starting from cell A1. Print the column names on row 1
ws.Cells["A1"].LoadFromDataTable(tbl, true); //Format the header for column 1-3
using (ExcelRange rng = ws.Cells["A1:C1"])
{
rng.Style.Font.Bold = true;
rng.Style.Fill.PatternType = ExcelFillStyle.Solid; //Set Pattern for the background to Solid
rng.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(, , )); //Set color to dark blue
rng.Style.Font.Color.SetColor(Color.White);
} //Example how to Format Column 1 as numeric
using (ExcelRange col = ws.Cells[, , + tbl.Rows.Count, ])
{
col.Style.Numberformat.Format = "#,##0.00";
col.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
} //Write it back to the client
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment; filename=ExcelDemo.xlsx");
Response.BinaryWrite(pck.GetAsByteArray());
}
在Web中使用
FileInfo newFile = new FileInfo(@"F:\mynewfile.xlsx");
using (ExcelPackage xlPackage = new ExcelPackage(newFile))
{
// get the first worksheet in the workbook
ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets[];
int iCol = ;
for (int iRow = ; iRow < ; iRow++)
{
string valueStr = string.Format("Cell({0},{1}).Value={2}", iRow, iCol, worksheet.Cells[iRow, iCol].Value);//循环取出单元格值
string value_Str = string.Format("Cell({0},{1}).Formula={2}", , iCol, worksheet.Cells[, iCol].Formula);//取公式(失败了)
}
}
读取Excel表格中的内容
FileInfo newFile = new FileInfo(@"F:\mynewfile.xlsx");
ExcelPackage pck = new ExcelPackage(newFile);
//Add the Content sheet
var ws = pck.Workbook.Worksheets.Add("Content"); #region 缩略column
ws.View.ShowGridLines = false;
ws.Column().OutlineLevel = ;//0表示没有线
ws.Column().Collapsed = true;//合并
ws.Column().OutlineLevel = ;
ws.Column().Collapsed = true;
ws.OutLineSummaryRight = true;
ws.Cells["B1"].Value = "Name";
ws.Cells["C1"].Value = "Size";
ws.Cells["D1"].Value = "Created";
ws.Cells["E1"].Value = "Last modified";
ws.Cells["B1:E1"].Style.Font.Bold = true;
#endregion #region 添加图片到Excel中
Bitmap icon = new Bitmap(@"F:\3765249-468df6edf927b569.jpg");
int row = ;
ws.Row(row).Height = ;//设置整个第五行的高度
//Add the icon as a picture
if (icon != null)
{
ExcelPicture pic = ws.Drawings.AddPicture("pic" + (row).ToString(), icon);
pic.SetPosition((int) * (row - ) + , );//margin-left:0px; margin-top:(int)20 * (row - 1) [20:默认的单元格高度]
}
ws.Cells[, ].Formula = string.Format("SUBTOTAL(9, {0})", ExcelCellBase.GetAddress( + , , row - , ));
#endregion #region 定义一块矩形,自由填写文字
var shape = ws.Drawings.AddShape("txtDesc", eShapeStyle.Rect);
shape.SetPosition(, , , );//(第7行,向下偏移10px,第7列,向右偏移10px)
shape.SetSize(, );
shape.Text = "这是一块自定义的区域, Shapes and charts.\n\r\n\r这是换行之后的内容...";
shape.Fill.Style = eFillStyle.SolidFill;
shape.Fill.Color = Color.DarkSlateGray;
shape.Fill.Transparancy = ;//透明度
shape.Border.Fill.Style = eFillStyle.SolidFill;
shape.Border.LineStyle = eLineStyle.LongDash;
shape.Border.Width = ;
shape.Border.Fill.Color = Color.Black;
shape.Border.LineCap = eLineCap.Round;
shape.TextAnchoring = eTextAnchoringType.Top;
shape.TextVertical = eTextVerticalType.Horizontal;
shape.TextAnchoringControl = false;
#endregion #region 超链接
var namedStyle = pck.Workbook.Styles.CreateNamedStyle("HyperLink"); //This one is language dependent
namedStyle.Style.Font.UnderLine = true;
namedStyle.Style.Font.Color.SetColor(Color.Blue);
ws.Cells["K12"].Hyperlink = new ExcelHyperLink(@"A51", "Statistics");//在K12单元格设置一个超链接,点击该超链接可以快速定位到A51单元格
ws.Cells["K12"].StyleName = "HyperLink";
#endregion pck.Save();//保存Excel表格
缩略column,添加图片到Excel中,定义一块矩形填写内容,超链接
public void TiaoXingTu()
{
FileInfo newFile = new FileInfo(@"F:\test.xlsx");
using (ExcelPackage package = new ExcelPackage(newFile))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("test");//工作簿名称 worksheet.Cells.Style.WrapText = true;//自动换行
worksheet.View.ShowGridLines = false;//去掉sheet的网格线 worksheet.Cells[, ].Value = "名称";
worksheet.Cells[, ].Value = "价格";
worksheet.Cells[, ].Value = "销量"; worksheet.Cells[, ].Value = "大米";
worksheet.Cells[, ].Value = ;
worksheet.Cells[, ].Value = ; worksheet.Cells[, ].Value = "玉米";
worksheet.Cells[, ].Value = ;
worksheet.Cells[, ].Value = ; worksheet.Cells[, ].Value = "小米";
worksheet.Cells[, ].Value = ;
worksheet.Cells[, ].Value = ; worksheet.Cells[, ].Value = "糯米";
worksheet.Cells[, ].Value = ;
worksheet.Cells[, ].Value = ; using (ExcelRange range = worksheet.Cells[, , , ])//取一块区域 从1行1列那个单元格开始,向下取5行,向右取3列
{
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
range.Style.VerticalAlignment = ExcelVerticalAlignment.Center;
} using (ExcelRange range = worksheet.Cells[, , , ])
{
range.Style.Font.Bold = true;
range.Style.Font.Color.SetColor(Color.White);
range.Style.Font.Name = "微软雅黑";
range.Style.Font.Size = ;
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(, , ));
} worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , )); worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , )); worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , )); worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , )); worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , ));
worksheet.Cells[, ].Style.Border.BorderAround(ExcelBorderStyle.Thin, Color.FromArgb(, , )); //创建一个图表
ExcelChart chart = worksheet.Drawings.AddChart("chart", eChartType.ColumnClustered); //chart.Series.Add()方法所需参数为:chart.Series.Add(Y轴数据区,X轴数据区)
ExcelChartSerie serie = chart.Series.Add(worksheet.Cells[, , , ], worksheet.Cells[, , , ]);
serie.HeaderAddress = worksheet.Cells[, ];//设置图表的图例 chart.SetPosition(, );
chart.SetSize(, );
chart.Title.Text = "销量走势";
chart.Title.Font.Color = Color.FromArgb(, , );
chart.Title.Font.Size = ;
chart.Title.Font.Bold = true;
chart.Style = eChartStyle.Style15;
chart.Legend.Border.LineStyle = eLineStyle.Solid;
chart.Legend.Border.Fill.Color = Color.FromArgb(, , ); package.Save();
}
}
生成简单条形图
public void bingTu()
{
using (ExcelPackage pck = new ExcelPackage())
{
//Create the worksheet
ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Demo");
//ws.Cells["A1"].Value = "饼图示例";
ws.Cells[, ].Value = "名称";
ws.Cells[, ].Value = "价格";
ws.Cells[, ].Value = "销量"; ws.Cells[, ].Value = "大米";
ws.Cells[, ].Value = ;
ws.Cells[, ].Value = ; ws.Cells[, ].Value = "玉米";
ws.Cells[, ].Value = ;
ws.Cells[, ].Value = ; ws.Cells[, ].Value = "小米";
ws.Cells[, ].Value = ;
ws.Cells[, ].Value = ; ws.Cells[, ].Value = "糯米";
ws.Cells[, ].Value = ;
ws.Cells[, ].Value = ;
using (ExcelRange r = ws.Cells["A1:C1"])
{
r.Merge = true;
r.Style.Font.SetFromFont(new Font("Arial", , FontStyle.Italic));
r.Style.Font.Color.SetColor(Color.White);
r.Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.CenterContinuous;
r.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
r.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(, , )); //Add the piechart
var pieChart = ws.Drawings.AddChart("crtExtensionsSize", eChartType.PieExploded3D) as ExcelPieChart;
//Set top left corner to row 1 column 2
pieChart.SetPosition(, , , );
pieChart.SetSize(, ); pieChart.Series.Add(ws.Cells[, , , ], ws.Cells[, , , ]);//chart.Series.Add(Y轴数据区,X轴数据区)
//pieChart.Series.Add(ws.Cells[2, 3, 15, 13], ws.Cells[2, 3, 15, 13]);
//pieChart.Series.Add(ExcelRange.GetAddress(4, 2, 2, 2), ExcelRange.GetAddress(4, 1, 3, 1)); pieChart.Title.Text = "Extension Size";
//Set datalabels and remove the legend
pieChart.DataLabel.ShowCategory = true;
pieChart.DataLabel.ShowPercent = true;
pieChart.DataLabel.ShowLeaderLines = true;
pieChart.Legend.Remove(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment; filename=ExcelDemo.xlsx");
Response.BinaryWrite(pck.GetAsByteArray());
}
}
}
生成简单饼图
public static void GenerateExcelReport()
{
string fileName = "ExcelReport-" + DateTime.Now.ToString("yyyy_MM_dd_HHmmss") + ".xlsx";
string reportTitle = "2013年度五大公司实际情况与原计划的百分比";
FileInfo file = new FileInfo("F:\\" + fileName);
using (ExcelPackage package = new ExcelPackage(file))
{
ExcelWorksheet worksheet = null;
ExcelChartSerie chartSerie = null;
ExcelLineChart chart = null;
#region research
worksheet = package.Workbook.Worksheets.Add("Data");
DataTable dataPercent = GetDataPercent();
//chart = Worksheet.Drawings.AddChart("ColumnStackedChart", eChartType.Line) as ExcelLineChart;
chart = worksheet.Drawings.AddChart("ColumnStackedChart", eChartType.LineMarkers) as ExcelLineChart;//设置图表样式
chart.Legend.Position = eLegendPosition.Right;
chart.Legend.Add();
chart.Title.Text = reportTitle;//设置图表的名称
//chart.SetPosition(200, 50);//设置图表位置
chart.SetSize(, );//设置图表大小
chart.ShowHiddenData = true;
//chart.YAxis.MinorUnit = 1;
chart.XAxis.MinorUnit = ;//设置X轴的最小刻度
//chart.DataLabel.ShowCategory = true;
chart.DataLabel.ShowPercent = true;//显示百分比 //设置月份
for (int col = ; col <= dataPercent.Columns.Count; col++)
{
worksheet.Cells[, col].Value = dataPercent.Columns[col - ].ColumnName;
}
//设置数据
for (int row = ; row <= dataPercent.Rows.Count; row++)
{
for (int col = ; col <= dataPercent.Columns.Count; col++)
{
string strValue = dataPercent.Rows[row - ][col - ].ToString();
if (col == )
{
worksheet.Cells[row + , col].Value = strValue;
}
else
{
double realValue = double.Parse(strValue);
worksheet.Cells[row + , col].Style.Fill.PatternType = ExcelFillStyle.Solid;
worksheet.Cells[row + , col].Style.Numberformat.Format = "#0\\.00%";//设置数据的格式为百分比
worksheet.Cells[row + , col].Value = realValue;
if (realValue < 0.90d)//如果小于90%则该单元格底色显示为红色
{ worksheet.Cells[row + , col].Style.Fill.BackgroundColor.SetColor(Color.Red);
}
else if (realValue >= 0.90d && realValue <= 0.95d)//如果在90%与95%之间则该单元格底色显示为黄色
{
worksheet.Cells[row + , col].Style.Fill.BackgroundColor.SetColor(Color.Yellow);
}
else
{
worksheet.Cells[row + , col].Style.Fill.BackgroundColor.SetColor(Color.Green);//如果大于95%则该单元格底色显示为绿色
}
}
}
//chartSerie = chart.Series.Add(worksheet.Cells["A2:M2"], worksheet.Cells["B1:M1"]);
//chartSerie.HeaderAddress = worksheet.Cells["A2"];
//chart.Series.Add()方法所需参数为:chart.Series.Add(X轴数据区,Y轴数据区)
chartSerie = chart.Series.Add(worksheet.Cells[row + , , row + , + dataPercent.Columns.Count - ], worksheet.Cells["B1:M1"]);
chartSerie.HeaderAddress = worksheet.Cells[row + , ];//设置每条线的名称
}
//因为假定每家公司至少完成了80%以上,所以这里设置Y轴的最小刻度为80%,这样使图表上的折线更清晰
chart.YAxis.MinValue = 0.8d;
//chart.SetPosition(200, 50);//可以通过制定左上角坐标来设置图表位置
//通过指定图表左上角所在的行和列及对应偏移来指定图表位置
//这里CommpanyNames.Length + 1及3分别表示行和列
chart.SetPosition(CommpanyNames.Length + , , , );
#endregion research
package.Save();//保存文件
}
}
生成简单折线图
下面的是周金桥的demo
static string[] CommpanyNames = new string[] { "Microsoft", "IBM", "Oracle", "Google", "Yahoo", "HP" };
生成稍微复杂的折线图1
private static DataTable GetDataPercent()
{
string[] MonthNames = new string[] { "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" };
//private static readonly string[] CommpanyNames = new string[] { "Microsoft", "IBM", "Oracle", "Amazon", "Google", "Facebook", "Twitter", "Paypal", "Yahoo", "HP" };
DataTable data = new DataTable();
DataRow row = null;
Random random = new Random();
data.Columns.Add(new DataColumn("公司名", typeof(string)));
foreach (string monthName in MonthNames)
{
data.Columns.Add(new DataColumn(monthName, typeof(double)));
}
//每个公司每月的百分比表示完成的业绩与计划的百分比
for (int i = ; i < CommpanyNames.Length; i++)
{
row = data.NewRow();
row[] = CommpanyNames[i];
for (int j = ; j <= MonthNames.Length; j++)
{
//这里采用了随机生成数据,但假定每家公司至少完成了计划的85%以上
row[j] = 0.85d + random.Next(, ) / 100d;
}
data.Rows.Add(row);
} return data;
}
生成稍微复杂的折线图2
public static void GenerateExcelReport()
{
string fileName = "ExcelReport-" + DateTime.Now.ToString("yyyy_MM_dd_HHmmss") + ".xlsx";
string reportTitle = "2013年度五大公司实际情况与原计划的百分比";
FileInfo file = new FileInfo("F:\\" + fileName);
using (ExcelPackage package = new ExcelPackage(file))
{
ExcelWorksheet worksheet = null;
ExcelChartSerie chartSerie = null;
ExcelLineChart chart = null;
#region research
worksheet = package.Workbook.Worksheets.Add("Data");
DataTable dataPercent = GetDataPercent();
//chart = Worksheet.Drawings.AddChart("ColumnStackedChart", eChartType.Line) as ExcelLineChart;
chart = worksheet.Drawings.AddChart("ColumnStackedChart", eChartType.LineMarkers) as ExcelLineChart;//设置图表样式
chart.Legend.Position = eLegendPosition.Right;
chart.Legend.Add();
chart.Title.Text = reportTitle;//设置图表的名称
//chart.SetPosition(200, 50);//设置图表位置
chart.SetSize(, );//设置图表大小
chart.ShowHiddenData = true;
//chart.YAxis.MinorUnit = 1;
chart.XAxis.MinorUnit = ;//设置X轴的最小刻度
//chart.DataLabel.ShowCategory = true;
chart.DataLabel.ShowPercent = true;//显示百分比 //设置月份
for (int col = ; col <= dataPercent.Columns.Count; col++)
{
worksheet.Cells[, col].Value = dataPercent.Columns[col - ].ColumnName;
}
//设置数据
for (int row = ; row <= dataPercent.Rows.Count; row++)
{
for (int col = ; col <= dataPercent.Columns.Count; col++)
{
string strValue = dataPercent.Rows[row - ][col - ].ToString();
if (col == )
{
worksheet.Cells[row + , col].Value = strValue;
}
else
{
double realValue = double.Parse(strValue);
worksheet.Cells[row + , col].Style.Fill.PatternType = ExcelFillStyle.Solid;
worksheet.Cells[row + , col].Style.Numberformat.Format = "#0\\.00%";//设置数据的格式为百分比
worksheet.Cells[row + , col].Value = realValue;
if (realValue < 0.90d)//如果小于90%则该单元格底色显示为红色
{ worksheet.Cells[row + , col].Style.Fill.BackgroundColor.SetColor(Color.Red);
}
else if (realValue >= 0.90d && realValue <= 0.95d)//如果在90%与95%之间则该单元格底色显示为黄色
{
worksheet.Cells[row + , col].Style.Fill.BackgroundColor.SetColor(Color.Yellow);
}
else
{
worksheet.Cells[row + , col].Style.Fill.BackgroundColor.SetColor(Color.Green);//如果大于95%则该单元格底色显示为绿色
}
}
}
//chartSerie = chart.Series.Add(worksheet.Cells["A2:M2"], worksheet.Cells["B1:M1"]);
//chartSerie.HeaderAddress = worksheet.Cells["A2"];
//chart.Series.Add()方法所需参数为:chart.Series.Add(X轴数据区,Y轴数据区)
chartSerie = chart.Series.Add(worksheet.Cells[row + , , row + , + dataPercent.Columns.Count - ], worksheet.Cells["B1:M1"]);
chartSerie.HeaderAddress = worksheet.Cells[row + , ];//设置每条线的名称
}
//因为假定每家公司至少完成了80%以上,所以这里设置Y轴的最小刻度为80%,这样使图表上的折线更清晰
chart.YAxis.MinValue = 0.8d;
//chart.SetPosition(200, 50);//可以通过制定左上角坐标来设置图表位置
//通过指定图表左上角所在的行和列及对应偏移来指定图表位置
//这里CommpanyNames.Length + 1及3分别表示行和列
chart.SetPosition(CommpanyNames.Length + , , , );
#endregion research
package.Save();//保存文件
}
}
生成稍微复杂的折线图3
EPPlus生成Excel表格(只支持2007及以上)的更多相关文章
- Qt高仿Excel表格组件-支持冻结列、冻结行、内容自适应和合并单元格
目录 一.概述 二.效果展示 三.实现思路 1.冻结行.冻结列 2.行高自适应 3.蚂蚁线 四.测试代码 1.添加表格数据 2.设置冻结行.列 3.行高.列宽 4.单元格背景色 5.单元格文字 6.其 ...
- H5纯前端生成Excel表格
H5纯前端生成Excel表格方法如下: <!DOCTYPE html> <html> <head> <title></title> < ...
- Java操作Jxl实现导出数据生成Excel表格数据文件
实现:前台用的框架是Easyui+Bootstrap结合使用,需要引入相应的Js.Css文件.页面:Jsp.拦截请求:Servlet.逻辑处理:ClassBean.数据库:SQLserver. 注意: ...
- 详解python操作生成excel表格,并且填充数据
最近在研究python操作excel表格的问题,首先读取excel表格觉得平时用的多,不怎么有难度,就是pyhon生成excel表格的时候,平时不怎么用,所以重点研究了一下,现总结如下: 1.首先用到 ...
- 在.NET中使用EPPlus生成Excel报表 .
--摘抄自:http://blog.csdn.net/zhoufoxcn/article/details/14112473 在开发.NET应用中可能会遇到需要生成带图表(Chart)的Excel报表的 ...
- 数据库数据生成Excel表格(多用在导出数据)
最近在项目开发中遇到这样一个需求,用户聊天模块产品要求记录用户聊天信息,但只保存当天的,每天都要刷新清空数据,但聊天记录要以Excel的形式打印出来,于是就引出了将数据库的数据导出成Excel表格的需 ...
- JavaWeb开发中采用FreeMarker生成Excel表格
最近做了一个需求,要求导出一个采购合同的Excel表格,这个表格样式比较多.由于是合同,这个Excel表格里面有好多格式要求,比如结尾处签字那部分就有格式要求.这里介绍种采用FreeM ...
- PHP生成excel表格文件并下载
本文引自网络,仅供自己学习之用. 利用php导出excel我们大多会直接生成.xls文件,这种方便快捷. function createtable($list,$filename){ header(& ...
- 使用Aspose插件将程序中的表格,导出生成excel表格
http://www.cnblogs.com/lanyue52011/p/3372452.html这个是原文地址 /// <summary> /// 点击按钮,将内存表导出excel表格! ...
随机推荐
- Vue使用Elementui修改默认最快方法!
相信大家都需要过,在Vue中使用Elementui的时候,遇到最多也最蛋疼的问题就是修改默认样式,接下来直奔主题: // template <el-progress :text-inside=& ...
- openlayers之全屏控件的使用
import { FullScreen } from 'ol/control' map.addControl(new FullScreen())
- NTL 库函数
NTL是一个高性能,可移植的C ++库,为任意长度的整数提供数据结构和算法; 可用于整数和有限域上的向量,矩阵和多项式; 可用于任意精度浮点运算. NTL为以下方面提供高质量的最先进算法实现: 任意长 ...
- mysql如何快速创建相同结构的表
[1]. 快速创建相同结构的表,包括索引: mysql> SHOW CREATE TABLE a; CREATE TABLE `a` ( `name` varchar(50) default N ...
- python、mysql三-1:存储引擎
一 什么是存储引擎 mysql中建立的库===>文件夹 库中建立的表===>文件 现实生活中我们用来存储数据的文件有不同的类型,每种文件类型对应各自不同的处理机制:比如处理文本用txt类型 ...
- Linux grep命令 -- 三剑客老三
常用选项 -E :开启扩展(Extend)的正则表达式. -i :忽略大小写(ignore case). -v :反过来(invert),只打印没有匹配的,而匹配的反而不打印. -n :显示行号 -w ...
- Qt Creator 4.10 Beta版发布
使用Qt Creator 4.10 Beta,现在支持固定文件,因此即使在关闭所有文件时它们仍然保持打开状态,围绕语言服务器协议支持继续集成,将Android目标添加到CMake/Qbs项目,支持Bo ...
- Linux基本命令之Vim
在vim,vi,gedit编辑器中显示行号: 在命令模式下:set nu 取消行号:set nonu 参照博客:https://www.cnblogs.com/Mr0wang/p/728 ...
- jquery 自定义右键菜单
如果要自定义右键菜单,那么就需要禁止原本的右键菜单,代码如下 document.oncontextmenu = new Function("return false;");//禁止 ...
- TCP超时与重传机制与拥塞避免
TCP超时与重传机制 TCP协议是一种面向连接的可靠的传输层协议,它保证了数据的可靠传输,对于一些出错,超时丢包等问题TCP设计的超时与重传机制. 基本原理:在发送一个数据之后,就开启一个定时器,若是 ...