<script type="text/javascript">
var c = new Calendar("c");
document.write(c);
function AutomateExcel(){
var elTable = document.getElementById("datatable"); //要导出的table id。
var appExcel = new ActiveXObject('excel.Application');
appExcel.Workbooks.Add().Worksheets.Item(1).Paste();
var oRangeRef = document.body.createTextRange();
oRangeRef.moveToElementText(elTable);
oRangeRef.execCommand('Copy');
appExcel.Visible = true;
appExcel = null;
}
/*
function OpenWord(){
ExcelSheet = new ActiveXObject('excel.Application');
ExcelSheet.Application.Visible = true;
var orgNum=ExcelSheet.Documents.Add('',0,1);
myRange =orgNum.Range(0,1)
sel=parent.document.body.createTextRange();
oTblExport = parent.document.getElementById("datatable");
if (oTblExport != null) {
sel.moveToElementText(oTblExport);
sel.execCommand('Copy');
parent.document.body.blur();
myRange.Paste();
}
}
*/
</script>
def printResumeInfoPwd = {
def resumeInfo = session.printuser
if(resumeInfo){
//---导出Excel开始
//create Excel文件
def fileName = "excel2.xls"
String filePath=request.getRealPath(fileName);
println "filePath:" + filePath
File myFilePath=new File(filePath);
if(!myFilePath.exists())
myFilePath.createNewFile();
FileWriter resultFile=new FileWriter(myFilePath);
PrintWriter myFile=new PrintWriter(resultFile);
resultFile.close();
//excel工作表的标题
def title = ["流水编号","职称类别","姓名","性别","健康状况","民族","出生年月",
"出生地","政治面貌","最高学历","婚姻状况","计算机能力","身高","执业资格证书编号",
"发证单位","专业技术资格名称","专业技术资格时间","专业技术资格聘用时间","身份证号",
"择业意向:月薪","择业意向:单位性质","择业意向:地区","择业意向:用工方式","其他:论文及著作",
"其他:专业特长、科研成果","其他:备注","其他:诚信记录","联系方式:户籍地址","联系方式:邮政编码","联系方式:现居住(联系)地址",
"联系方式:邮政编码","联系方式:联系电话(白天)","联系方式:联系电话(晚上)","联系方式:手机","联系方式:电子邮件"] as String[]
String sheetName = "卫生人才招聘系统"
try{
OutputStream outf = new FileOutputStream(filePath);
jxl.write.WritableWorkbook wwb = Workbook.createWorkbook(outf);
jxl.write.WritableSheet ws = wwb.createSheet(sheetName, 0);
jxl.write.Label label;
for (int i=0; i<title.length; i++){
//Label(列号,行号 ,内容 )
label = new jxl.write.Label(i, 0, title[i]); //put the title in row1
ws.addCell(label);
}
for (int k = 0; k < resumeInfo?.size; k++){
def id = resumeInfo.get(k)?.id.toInteger()
def resumeInfoInstance = ResumeInfo.get(id)
def content = [resumeInfoInstance.water,resumeInfoInstance.titleType,resumeInfoInstance.userName,resumeInfoInstance.sex,resumeInfoInstance.health,resumeInfoInstance.nation?.codeValue,resumeInfoInstance.birthday,
resumeInfoInstance.birthPlace,resumeInfoInstance.politicalStatus?.codeValue,resumeInfoInstance.qualification,resumeInfoInstance.marryStatus,resumeInfoInstance.computerAbility,resumeInfoInstance.high,
resumeInfoInstance.certificateCode,resumeInfoInstance.certificateUnit,resumeInfoInstance.certificateName,resumeInfoInstance.certificateTime,resumeInfoInstance.certificateLong,resumeInfoInstance.identityCard,
resumeInfoInstance.searchMonthSalary?.codeValue,resumeInfoInstance.companyType?.codeValue,resumeInfoInstance.searchArea?.codeValue,resumeInfoInstance.workType?.codeValue,
resumeInfoInstance.thesis,resumeInfoInstance.achievement,resumeInfoInstance.remark,resumeInfoInstance.integrity,
resumeInfoInstance.placeOfBirth,resumeInfoInstance.bpostalCode,resumeInfoInstance.linkAddress,resumeInfoInstance.lpostalCode,
resumeInfoInstance.phoneDay,resumeInfoInstance.phoneNight,resumeInfoInstance.mobile,resumeInfoInstance.email] as String[]
for (int j=0; j<content.length; j++){
//Label(列号,行号 ,内容 )
label = new jxl.write.Label(j, k+1, content[j]);
ws.addCell(label);
}
}
wwb.write();
wwb.close();
}catch(Exception e){
System.out.println(e);
}
//----导出Excel结束
flash.message = "导出成功!"
redirect(url:"http://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"+ fileName)
}else{
flash.message = "请先查询结果集……"
render(view:"../management/statistics_preexcl")
}
}
<script>
function checkpwd(){
//var height = document.body.clientHeight;
returnValue=window.showModalDialog("${request.getContextPath()}/management/jump9.gsp","","edge:raised;center:Yes;help:No;resizable:no;status:no;dialogHeight:170px;dialogWidth:400px");
if(returnValue && returnValue == "checkok"){
window.location.href="${request.getContextPath()}/resumeInfo/printResumeInfoPwd";
}
}
</script>
//-------------------------------------
<script src="${request.getContextPath()}/js/jquery-142min.js" language="javascript"></script>
<script type="text/javascript">
function checkthis(){
var pwd = document.getElementById("pwd").value;
if(pwd == null || pwd == ""){
jsMessage = "*密码不能为空!";
document.getElementById("errMessage").innerHTML = jsMessage;
}else{
$.ajax({
type: "POST",
url: "${request.getContextPath()}/resumeInfo/checkPwd",
data: "pwd="+document.getElementById("pwd").value,
success: function(msg){
if(msg == "error"){
jsMessage = "*密码错误!";
document.getElementById("errMessage").innerHTML = jsMessage;
}else{
window.returnValue = "checkok";
window.close();
}
}
});
//jsMessage = "*密码错误!";
//document.getElementById("errMessage").innerHTML = jsMessage;
}
}
</script>