/**
*
*
* @param table_id テーブル ID
* @paramcontainer_id コンテナ ID
* @param form_id 送信フォーム ID
* @param タイトル ファイル名
* @パラメータ行番号
*/
function getXlsFromTbl(table_id,container_id ,form_id, title, rownumbers) {
try {
var content = "";
if (table_id != null && table_id != "" && table_id != "null") {
content = getTblData($('#' テーブル ID), $('#' コンテナ ID), 行番号);
}
if (content == "") {
alter("表格無し");
戻る;
}
var fileName = getExcelFileName(title);
doFileExport($('#' form_id), fileName, content);
}
catch (e) {
alert("导出异常:" e.name "->" e.description "!");
}
}
function getTblData(tableobj,containerobj, rownumbers) {
var outStr = "";
if (tableobj != null) {
var rowdata = tableobj.getRowData();
var Lenr = 1;
for (i = 0; i < Lenr; i ) {
//var Lenc = curTbl.rows(i).cells.length;
変数 th;
if (rownumbers == false) {
th =containerobj.find('TH:not(:first-child)');
}
else {
th =containerobj.find('TH');
}
th.each(function(index, element) {
var j = インデックス 1;
var content = $(element).text();
content = content.replace (/(^s*)|(s*$)/g, "");//去掉空格
outStr = content ",";
});
outStr = " nl ";
}
var tmp = "";
for (i = 0; i var row = eval(rowdata[i]);
for (各行) {
var temp = $(row[each]).text();
if($(row[each]).text() == null || $(row[each]).text() == ""){
if(row[each].charAt(0) != '<')
outStr = row[それぞれ] ",";
}
else
outStr = $(row[each]).text() ",";
}
outStr = " nl ";
}
}
else {
outStr = null;
alert(inTbl " null!");
}
return outStr;
}
function getExcelFileName(title) {
var d = new Date();
var cur Year = d.get Year();
var curMonth = "" (d.getMonth() 1);
var curDate = "" d.getDate();
var curHour = "" d.getHours();
var curMinute = "" d.getMinutes();
var curSecond = "" d.getSeconds();
if (curMonth.length == 1) {
curMonth = "0" curMonth;
}
if (curDate.length == 1) {
curDate = "0" curDate;
}
if (curHour.length == 1) {
curHour = "0" curHour;
}
if (curMinute.length == 1) {
curMinute = "0" curMinute;
}
if (curSecond.length == 1) {
curSecond = "0" curSecond;
}
var fileName = title "_" cur Year curMonth curDate "_"
curHour curMinute curSecond ".csv";
ファイル名を返します。
}
function doFileExport(formobj, filename, content) {
formobj.html("
");
$("#filename").val(filename);
$("#content").val(content);
formobj.submit();
}