<%@ Page Language="C#" EnableEventValidation="false" ResponseEncoding="gb2312" ContentType="application/vnd.ms-excel" %>

<%@ Import Namespace="IriskingAttend.Web" %>
<%@ Import Namespace="System" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/vnd.ms-excel; charset=gb2312">
<meta name="ProgId" content="Excel.Sheet">
<meta name="Generator" content="Microsoft Excel 11">
</head>
<body>
<%
Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "utf-8"; Response.AddHeader("Content-Disposition", "inline; filename=" + "luanma.xls");
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=utf-8>");
%>
<div>
<table x:str border="1" cellpadding="0" cellspacing="0" style='border-collapse: collapse;
text-align: center; table-layout: fixed; width: 1000pt; height: 102px;'>
<%
DateTime beginTime = Convert.ToDateTime(Request.QueryString["beginTime"]);
DateTime endTime = Convert.ToDateTime(Request.QueryString["endTime"]);
string departName = Request.QueryString["departName"];
int length = (int)endTime.AddDays(1).Subtract(beginTime).TotalDays;
%>
<tr>
<td colspan="<%=(length+15) %>" rowspan="2" align="center">
郭二庄月出勤明细报表 <span style='mso-spacerun: yes'> </span>
<%=beginTime.ToString("yyyy-MM-dd")%>

<%=endTime.ToString("yyyy-MM-dd")%> <span>部门:<%=departName %></span>
</td>
</tr>
<tr> </tr>
<tr>
<td rowspan="2" align="center">
姓名
</td>
<td rowspan="2" align="center">
考勤号
</td>
<td rowspan="2" align="center">
工数
</td>
<td colspan="2" class="style2" align="center">
其中
</td>
<% for (DateTime mindate = beginTime; mindate <= endTime; mindate = mindate.AddDays(1))
{ %>
<td rowspan="2" class="style1" align="center">
<%=mindate.Day.ToString("d2")%>
</td>
<% } %>
<td colspan="3" class="style1" align="center">
对比数据
</td>
<td colspan="2" class="style2" align="center">
对比后
</td>
<td colspan="2" class="style2" align="center">
有工数
</td>
<td rowspan="2" class="style2" align="center">
有工数
</td>
<td colspan="2" class="style2" align="center">
其中:夜班
</td>
</tr>
<tr>
<td rowspan="1" align="center">
工数
</td>
<td rowspan="1" align="center">
工数
</td>
<td rowspan="1" align="center">
工数
</td>
<td rowspan="1" align="center">
异常
</td>
<td colspan="1" align="center">
异常
</td>
<td rowspan="1" align="center">
工数
</td>
<td rowspan="1" align="center">
工数
</td>
<td rowspan="1" align="center">
有资
</td>
<td colspan="1" align="center">
有资
</td>
<td rowspan="1" align="center">
井上工数
</td>
<td rowspan="1" align="center">
井下工数
</td>
</tr>
<%
for (int i = 0; i < DomainServiceIriskingAttend._monthAttendList.Count; i++)
{%>
<tr height="19" style='height: 14.25pt'>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].PersonName%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].AttendSn%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].WorkConut%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].WorkCount%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].WorkCount%>
</td>
<% for (int j = 0; j < length; j++)
{ %>
<td>
<%= DomainServiceIriskingAttend._monthAttendList[i].DailySign[j]??"" %>
</td>
<% } %>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].NormalWorkCount%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].Exception%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].LocationException%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].AfterOn%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].AfterIn%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].YouZi%>
</td>
<td>
<%=DomainServiceIriskingAttend._monthAttendList[i].YouZi%>
</td>
<td class="style2">
<%=DomainServiceIriskingAttend._monthAttendList[i].WorkCountable%>
</td>
<td class="style1">
<%=DomainServiceIriskingAttend._monthAttendList[i].NightOn%>
</td>
<td class="style1">
<%=DomainServiceIriskingAttend._monthAttendList[i].NightIn%>
</td>
</tr>
<%}%>
</table>
</div>
</body>
</html>

  //使用contentType 直接将输出格式改成application/vnd.ms-xls, 页面导向到这里直接下载。比较菜也是相对简单的一种方法

//在IE下 中文文件名乱码问题解决

 string filename = "中文名称乱码.xls";
// IE浏览器乱码问题,只能采用URLEncoder编码
filename = HttpUtility.UrlEncode(filename, Encoding.UTF8);
Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "utf-8"; Response.AddHeader("Content-Disposition", "inline; filename=" + filename);

  

使用aspx 直接生成excel的更多相关文章

  1. asp.net 生成 excel导出保存时, 解决迅雷下载aspx页面问题

    网络上搜索,一大堆废话,以下为简单的导出生成Excel代码: string excelFile = Server.MapPath("~/SB/UpFile/20151104111008/Bo ...

  2. Asp.net MVC 简单实现生成Excel并下载

    由于项目上的需求,需要导出指定条件的Excel文件.经过一翻折腾终于实现了. 现在把代码贴出来分享 (直接把我们项目里面的一部份辅助类的代码分享一下) 我们项目使用的是Asp.Net MVC4.0模式 ...

  3. 两种方式实现java生成Excel

    Web应用中难免会遇到需要将数据导出并生成excel文件的需求.同样,对于本博客中的总结,也是建立在为了完成这样的一个需求,才开始去了解其实现形式,并且顺利完成需求的开发,先将实现过程总结于此.本博文 ...

  4. 使用node.js生成excel报表下载(excel-export express篇)

    引言:日常工作中已经有许多应用功能块使用了nodejs作为web服务器,而生成报表下载也是我们在传统应用. java中提供了2套类库实现(jxl 和POI),.NET 作为微软的亲儿子更加不用说,各种 ...

  5. Python实战 :2017国考职业表excel转数据库,再查询生成excel

    最近看2017年国考的职业表,多而杂,不好过滤我想要的信息,特此把它转成Sqlite3数据库,再从数据库里把查询结果导出成excel,方便找职业. (后附上整套代码) 环境:python2.7   x ...

  6. asp.net+nopi生成Excel遇到设置单元格值null问题

    Npoi 生成excel报表功能很不错,功能也不用给大家介绍了.首先看遇到的问题吧! FileStream file = new FileStream(Server.MapPath("Tem ...

  7. phpexcel生成excel并下载

    Loader::import('PHPExcel.Classes.PHPExcel'); // tp5中只需将phpexcel文件放入extend文件夹中,即可采用该方法引入,需要先 use thin ...

  8. java动态生成excel打包下载

    @SuppressWarnings("unchecked") public String batchExport() throws DBException{ @SuppressWa ...

  9. JAVA利用JXL导出/生成 EXCEL

    /** * 导出导出采暖市场部收入.成本.利润明细表 * @author JIA-G-Y */ public String exporExcel(String str) { String str=Se ...

随机推荐

  1. bytes,bytearray

    1.bytes.bytearray ---Python3 引入的! bytes:不可变字节序列,bytearray:字节属组,可变 都是连续的空间. 2.字符串与bytes 字符串是字符组成的有序的序 ...

  2. 简单数据库开发之dao层开发

    数据库 dao层是用来与底层数据库连接的一系列代码,它因上层service层调用而调用底层数据库,因为一般的数据库不会只存在一到几张表格,所以必须定义出dao层的接口协议,方便各种表格的操作. dao ...

  3. 系统重启后,mr程序不生成当前时间段的MRx文件问题

    系统重启后,mr程序不生成当前时间段的MRx文件问题 2019-4-2 之前使用正常的MR程序,系统重启后无法生成MRE\MRO\MRS文件. 服务器有两个时钟:硬件时钟和系统时钟 硬件时钟从根本上讲 ...

  4. linux-rhel7配置网卡bond双网卡主备模式

    参考以下文章中的 2.centos7配置bonding: https://www.cnblogs.com/huangweimin/articles/6527058.html 以下是配置过程的操作和打印 ...

  5. spring-boot war包

    接着上面的spring-boot项目,直接使用jar包方便调试,在开发阶段非常方便,生产上最好打成war形式 要想spring-boot打war包,还是从pom.xml入手 1.1 调整pom.xml ...

  6. php7.2连接Sqlserver2008 r2

    下载Sql Server PHP扩展 Microsoft Drivers for PHP for SQL Server https://github.com/Microsoft/msphpsql/re ...

  7. linux服务器情况

    查看Linux 进程命令  ps -aux 或者ps -ef linux 进程很多 如果需要查找某一个进程可以使用 管道和grep命令 Linux下常用命令  grep  匹配字符   ps 查询Li ...

  8. 基于Spark自动扩展scikit-learn (spark-sklearn)(转载)

    转载自:https://blog.csdn.net/sunbow0/article/details/50848719 1.基于Spark自动扩展scikit-learn(spark-sklearn)1 ...

  9. canal mysql slave

    [mysqld] log-bin=mysql-bin #添加这一行就ok binlog-format=ROW #选择row模式 server_id=1 #配置mysql replaction需要定义, ...

  10. Chrome Inspect调试微信出现空白页面的解决方法

    首先,需要打开手机的USB调试和微信的TBS 调试开关. 如果不打开TBS开关,Inspect时会检测不到任何微信的H5页面 使用微信扫码下方二维码,打开TBS调试开关: 普通网页: 小程序: 微信扫 ...