gpt4 book ai didi

javascript - 将fusioncharts导出为ppt

转载 作者:行者123 更新时间:2023-11-30 06:40:54 27 4
gpt4 key购买 nike

在这里,我尝试在单击按钮时将 fusioncharts 导出为 ppt。首先,我将 fusioncharts 转换为图像,然后将它们导出为 ppt。因为我需要在保存图像后生成 ppt,所以我使用的是 秒表 javascript 中的函数来计算将 fusioncharts 转换为图像所花费的时间。这是我的代码:

 <script type="text/javascript">
var initiateExport = false;
var _sw = new StopWatch();
var time;
function exportReport() {
exportCharts();
return false;
}
function exportCharts() {
_sw.start();
var exportFormat = 'JPG';
initiateExport = true;
for (var chartRef in FusionCharts.items) {
if (FusionCharts.items[chartRef].exportChart) {
document.getElementById("linkToExportedFile").innerHTML = "Exporting...";
FusionCharts.items[chartRef].exportChart({ "exportFormat": exportFormat });

}
else {
document.getElementById("linkToExportedFile").innerHTML = "Please wait till the chart completes rendering...";
}
}
}
function FC_Exported(statusObj) {
_sw.stop();
time = _sw.duration();
setTimeout(' document.getElementById("MainContent_Button1").click();', time);

}
</script>

在上面的代码中,document.getElementById("MainContent_Button1").click(); 函数生成了 ppt。我的问题是因为我有 3 个 fusioncharts,函数 FC_Exported 被执行了 3 次。所以我收到 ppt 提示 3 次。我希望它只发生 1 次。另外我认为 ppt 代码的位置不能更改,因为我正在使用 time参数。有人可以指导我吗?等待您的回复。谢谢。

注意:计时器的停止功能不能放在其他任何地方,因为我想要生成和保存图像所花费的总时间。

最佳答案

最近我使用fusioncharts导出为ppt。过程非常简单,如下所示:

- Capture image from the client side 
- Save Image at server side
- Use Apache POI to create a slideshow
- Add stored image in slide as :

// get server context
ServletContext context = request.getServletContext();

// get image stored file path
String []imagefilename=filename.split("/ExportedImages");

// get image filename
String filename = context.getRealPath("/ExportedImages"+imagefilename[1]);


// Create Slide
Slide slide1 = slideShow.createSlide();
try {
int idx=slideShow.addPicture(new File(filename), org.apache.poi.hslf.model.Picture.JPEG);

org.apache.poi.hslf.model.Picture pict = new org.apache.poi.hslf.model.Picture(idx);

//set image position in the slide
pict.setAnchor(new java.awt.Rectangle(100, 100, 300, 200));

slide1.addShape(pict);


} catch (IOException e1) {

e1.printStackTrace();
}


- Then Download file

关于javascript - 将fusioncharts导出为ppt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11323257/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com