📄 exportexcel.jsp
字号:
buffer.append("</c:Label>\n ");
buffer.append("<c:MaxHeight>80%</c:MaxHeight>\n ");
buffer.append("<c:MaxWidth>80%</c:MaxWidth>\n ");
buffer.append("<c:NextSheetNumber>4</c:NextSheetNumber>\n ");
buffer.append("</c:ComponentOptions>\n ");
buffer.append("<x:WorkbookOptions>\n ");
buffer.append("<c:OWCVersion>10.0.0.4109</c:OWCVersion>\n");
buffer.append("<x:Height>7620</x:Height>\n");
buffer.append("<x:Width>15240</x:Width>\n");
buffer.append("</x:WorkbookOptions>\n");
buffer.append("<ss:Worksheet ss:Name=\"工作表\">\n ");
buffer.append("<x:WorksheetOptions>\n ");
buffer.append("<x:Selected/>\n ");
buffer.append("<x:ViewableRange>R1:R262144</x:ViewableRange>\n ");
buffer.append("<x:Selection>R1C1</x:Selection>\n ");
buffer.append("<x:TopRowVisible>0</x:TopRowVisible>\n ");
buffer.append("<x:LeftColumnVisible>0</x:LeftColumnVisible>\n ");
buffer.append("<x:ProtectContents>False</x:ProtectContents>\n ");
buffer.append("</x:WorksheetOptions>\n ");
buffer.append("<c:WorksheetOptions>\n </c:WorksheetOptions>\n ");
buffer.append("<ss:Table ss:DefaultColumnWidth=\"54.0\" ss:DefaultRowHeight=\"12.75\">");
buffer.append("<ss:Column ss:Width=\"54.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"54.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"150.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"120.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"100.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"250.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"250.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"80.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"54.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"120.0\" ss:AutoFitWidth=\"0\"/>");
buffer.append(content);
buffer.append("</ss:Table>\n</ss:Worksheet>\n");
buffer.append("</ss:Workbook>\n");
ExtString.replace(buffer, "&", "&");
ExtString.replace(buffer, "<", "<");
ExtString.replace(buffer, ">", ">");
ExtString.replace(buffer, "\"", """);
}
//openMode!=null
else {
if ( sFaqCoteID.equals("1") ) {
if ( ! auth.CheckPurv("NGB009001") ) {
out.write("<script language=javascript src=\"../../common/script/RightForbidden.js\"></script>");
return;
}
content.append("<ss:Row>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">城市名称</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">区域名称</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">新闻标题</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">发表时间</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">发帖人</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">新闻内容</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复内容</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复员工工号</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复人</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复时间</ss:Data>\n</ss:Cell>\n");
content.append("</ss:Row>\n");
}
else if ( sFaqCoteID.equals("2") ) {
if ( ! auth.CheckPurv("NGB009002") ) {
out.write("<script language=javascript src=\"../../common/script/RightForbidden.js\"></script>");
return;
}
content.append("<ss:Row>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">城市名称</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">区域名称</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">新闻标题</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">发表时间</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">发帖人</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">新闻内容</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复内容</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复员工工号</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复人</ss:Data>\n</ss:Cell>\n");
content.append("<ss:Cell ss:StyleID=\"wc0CEFE34C\"><ss:Data ss:Type=\"String\">回复时间</ss:Data>\n</ss:Cell>\n");
content.append("</ss:Row>\n");
}
else {
out.write("<script language=javascript>window.location.href='"+request.getContextPath() + "/view/sysmgr/OperFailure.jsp?error=参数不正确';</script>");
return;
}
for(int index=0;index<dt.getRows().getCount();index++){
content.append("<ss:Row>\n");
// 城市名称
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(dt.getRow(index).getString("cityname"));
content.append("</ss:Data></ss:Cell>\n");
// 区域名称
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(dt.getRow(index).getString("areaname"));
content.append("</ss:Data></ss:Cell>\n");
// 标题
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(getHTMLString(dt.getRow(index).getString("title")));
content.append("</ss:Data></ss:Cell>\n");
// 发表时间
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(dt.getRow(index).getString("lastdate"));
content.append("</ss:Data></ss:Cell>\n");
// 发表人
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(dt.getRow(index).getString("nickname"));//昵称
content.append("</ss:Data></ss:Cell>\n");
//发表内容
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(getHTMLString(dt.getRow(index).getString("content")));
content.append("</ss:Data></ss:Cell>\n");
//回复内容
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(getHTMLString(dt.getRow(index).getString("replycontent")));
content.append("</ss:Data></ss:Cell>\n");
//回复员工工号
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(dt.getRow(index).getString("replyuserid"));
content.append("</ss:Data></ss:Cell>\n");
//回复员工姓名
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(dt.getRow(index).getString("replynickname"));
content.append("</ss:Data></ss:Cell>\n");
//回复时间
content.append("<ss:Cell><ss:Data ss:Type=\"String\">");
content.append(dt.getRow(index).getString("replytime"));
content.append("</ss:Data></ss:Cell>\n");
content.append("</ss:Row>\n");
}
buffer.append("<?xml version=\"1.0\" encoding=\"GBK\"?>\n");
buffer.append("<?mso-application progid=\"Excel.Sheet\"?>\n");
buffer.append("<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"\n");
buffer.append("xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n");
buffer.append("xmlns:x=\"urn:schemas-microsoft-com:office:excel\"\n");
buffer.append("xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"\n");
buffer.append("xmlns:c=\"urn:schemas-microsoft-com:office:component:spreadsheet\"\n");
buffer.append("xmlns:html=\"http://www.w3.org/TR/REC-html40\">\n");
buffer.append("<DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">\n");
buffer.append("<LastAuthor>janage</LastAuthor>\n");
buffer.append("<Created>2005-12-09T01:49:38Z</Created>\n");
buffer.append("<Version>11.5606</Version>\n");
buffer.append("</DocumentProperties>\n");
buffer.append("<ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\">\n");
buffer.append("<WindowHeight>10005</WindowHeight>\n");
buffer.append("<WindowWidth>10005</WindowWidth>\n");
buffer.append("<WindowTopX>120</WindowTopX>\n");
buffer.append("<WindowTopY>135</WindowTopY>\n");
buffer.append("<ProtectStructure>False</ProtectStructure>\n");
buffer.append("<ProtectWindows>False</ProtectWindows>\n");
buffer.append("</ExcelWorkbook>\n");
buffer.append("<Styles>\n");
buffer.append("<Style ss:ID=\"Default\" ss:Name=\"Normal\">\n");
buffer.append("<Alignment ss:Vertical=\"Center\"/>\n");
buffer.append("<Font ss:FontName=\"宋体\" x:CharSet=\"134\" ss:Size=\"12\"/>\n");
buffer.append("</Style>\n");
buffer.append("<Style ss:ID=\"s21\">\n");
buffer.append("<Alignment ss:Vertical=\"Bottom\"/>\n");
buffer.append("<Font ss:FontName=\"宋体\"/>\n");
buffer.append("</Style>\n");
buffer.append("<Style ss:ID=\"s22\">\n");
buffer.append("<Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Center\"/>\n");
buffer.append("<Font ss:FontName=\"宋体\" ss:Bold=\"1\"/>\n");
buffer.append("</Style>\n");
buffer.append("<Style ss:ID=\"s23\">\n");
buffer.append("<Alignment ss:Horizontal=\"Center\" ss:Vertical=\"Bottom\"/>\n");
buffer.append("<Font ss:FontName=\"宋体\"/>\n");
buffer.append("</Style>\n");
buffer.append("</Styles>\n");
buffer.append("<Worksheet ss:Name=\"工作表\">\n");
buffer.append("<Table ss:ExpandedColumnCount=\"5\" ss:ExpandedRowCount=\"37\" x:FullColumns=\"1\"\n");
buffer.append("x:FullRows=\"1\" ss:StyleID=\"s21\" ss:DefaultColumnWidth=\"54\">\n");
buffer.append("<Column ss:StyleID=\"s23\" ss:AutoFitWidth=\"0\" ss:Width=\"50.25\"/>\n");
buffer.append("<Column ss:StyleID=\"s23\" ss:AutoFitWidth=\"0\" ss:Width=\"50.25\"/>\n");
buffer.append("<Column ss:StyleID=\"s21\" ss:AutoFitWidth=\"0\" ss:Width=\"150.5\"/>\n");
buffer.append("<Column ss:StyleID=\"s21\" ss:AutoFitWidth=\"0\" ss:Width=\"120\"/>\n");
buffer.append("<Column ss:StyleID=\"s21\" ss:AutoFitWidth=\"0\" ss:Width=\"107.25\"/>\n");
buffer.append("<Column ss:StyleID=\"s21\" ss:AutoFitWidth=\"0\" ss:Width=\"303.75\"/>\n");
buffer.append("<Column ss:StyleID=\"s21\" ss:AutoFitWidth=\"0\" ss:Width=\"303.75\"/>\n");
buffer.append("<ss:Column ss:Width=\"80.25\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"50.25\" ss:AutoFitWidth=\"0\"/>");
buffer.append("<ss:Column ss:Width=\"120.25\" ss:AutoFitWidth=\"0\"/>");
buffer.append(content);
buffer.append("</Table>\n</Worksheet>\n");
buffer.append("</Workbook>\n");
//ExtString.replace(buffer, "&", "&");
//ExtString.replace(buffer, "<", "<");
//ExtString.replace(buffer, ">", ">");
//ExtString.replace(buffer, "\"", """);
response.reset();
//response.setContentType("application/vnd.ms-excel; charset=gbk");
out.print(buffer);
out.close();
return ;
}
}
catch(Exception ex){
FileLogger.getLogger().warn(ex.getMessage(),ex);
}
%>
<html>
<head>
<!-- meta content="text/html; charset=GB18030" http-equiv="content-type" -->
<title><%= (sFaqCoteID!=null&&sFaqCoteID.equals("2"))?"咨询列表": "新闻列表"%></title>
<link href="../../common/style/main.css" rel="stylesheet" type="text/css"/>
</head>
<body style="margin: 0px">
<object width="100%" height="100%" classid="CLSID:0002E551-0000-0000-C000-000000000046">
<param name="DataType" value="XMLDATA">
<param name="XMLData" value="<%= buffer%>">
<table width='100%' cellpadding='0' cellspacing='0' border='0' height='8'>
<tr>
<td bgColor='#336699' height='15%' width='10%'> </td>
<td bgColor='#666666'width='85%'>
<font face='宋体' color='white' size='4'>
<b> 您的机器缺少Microsoft Office Web Components</b>
</font>
</td>
</tr>
<tr>
<td bgColor='#cccccc'> </td>
<td bgColor='#cccccc'><br>
<font face='宋体' size='2'>直接显示Excel数据需要 Microsoft Office Web Components。
<p align='center'> 一般装完Office后会自动安装该组件.</p></font>
<p><font face='宋体' size='2'>此网页同时要求 Microsoft Internet Explorer 5.01 或更高版本。</font></p>
<p align='center'><a href='http://www.microsoft.com/windows/ie/default.htm'> 单击此处安装最新的 Internet Explorer</a>.</p>
<br> </td></tr>
<tr>
<td bgColor='#cccccc'> </td>
<td bgColor='#cccccc'><form action='exportexcel.jsp' method='post'>
<input type='hidden' name='faqcoteid' value='<%= sFaqCoteID%>'/>
<input type='hidden' name='OPENMODE' value='excel'/>
<font face='宋体' size='2'>您还可以点击<input type='submit' value='这里'>将Excel数据下载并保存到磁盘中</font>
</form></td>
</tr>
</table>
</object>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -