报表导出为word格式
js代码
步骤一,上传图片
$("object").each(function(index) {if(this.hasRendered()) {this.exportChart({exportFormat: "JPEG",exportAction: "save",exportFileName: this.id,exportHandler: "bulletin-image"});chartParams.push("chartIds=" + this.id);if (index % 2 == 0) {$("html,body").animate({scrollTop: $(this).offset().top}, 100).delay(5500);}} else {alert("图表还未渲染完成,请稍后再试。");chartHasRendered = false;return false;}});
ExportBean exportBean = FusionChartsExportHelper.parseExportRequestStream(request);BufferedImage image = ImageGenerator.getChartImage(exportBean.getStream(), exportBean.getMetadata());String imageFileName = exportBean.getExportParameterValue("exportfilename") + ".jpg";File imageFile = new File(Dirs.BULLETIN_DIR + imageFileName);if (!imageFile.exists()) {imageFile.mkdirs();ImageIO.write(image, "jpeg", imageFile);}
@Result(name = "success", type = "stream", params = {"contentType", "application/msword", "inputName", "bulletinDoc","contentDisposition", "attachment;filename=${fileName}","bufferSize", "8192" }) })