如何使用PHP javascript将数据保存到Excel中 [英] How do I save data into excel using PHP javascript

查看:68
本文介绍了如何使用PHP javascript将数据保存到Excel中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,当我点击提交按钮时,我有html表单.data应该被移动到excel表再次如果我再输入一个html表单中的数据,应该附加在excel中而不是替换!!下面是我的html文件...请帮帮我。我不知道怎么做javascript plz帮帮我



我尝试过:





函数mytest1()

{



var ExcelApp = new ActiveXObject(Excel .Application);

var ExcelSheet = new ActiveXObject(Excel.Sheet);

//文本存储在第一个单元格中



ExcelSheet.ActiveSheet.Cells(1,1).Value =textarea1;

ExcelSheet.ActiveSheet.Cells(1,2).Value =textarea2 ;



//保存工作表

ExcelSheet.SaveAs(C:\\Users\\\ \\\Desktop\\TEST.xlsx);

//使用Application对象的Quit()方法关闭Excel

ExcelSheet.Application.Quit( );



}

Hi Friends, I have html form when I click submit button .data should be moved to a excel sheet Again if I entered one more data in html form that should be appended in excel not replace !! below is the my html file in ...please help me out. I dont no how to do in javascript plz help me

What I have tried:


function mytest1()
{

var ExcelApp = new ActiveXObject("Excel.Application");
var ExcelSheet = new ActiveXObject("Excel.Sheet");
// a text is stored in the first cell

ExcelSheet.ActiveSheet.Cells(1,1).Value = "textarea1";
ExcelSheet.ActiveSheet.Cells(1,2).Value = "textarea2";

// the sheet is saved
ExcelSheet.SaveAs("C:\\Users\\s\\Desktop\\TEST.xlsx");
// close Excel with the Quit() method of the Application object
ExcelSheet.Application.Quit();

}

推荐答案

而不是这个
ExcelSheet.SaveAs

使用以下代码

use the below code

ExcelApp.ActiveWorkbook.Save();







Refer below URL. It might help you.



javascript - 使用excel activeX保存而不是saveAs - Stack Overflow [ ^ ]


这篇关于如何使用PHP javascript将数据保存到Excel中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆