搬家第24天-citectv7.4cicode创建一个excel文档

有些情况下,我们需要把flexgrid控件的数据导出到excel文件,那么第一步就是需要创建一个excel文件

FUNCTION CreateExcelFile()
STRING filepath;
INT file;
filepath="[run]:\"+IntToStr(DateYear(TimeCurrent(),1))+"-"+IntToStr(DateMonth(TimeCurrent()))+"-"+IntToStr(DateDay(TimeCurrent()))+"_"+IntToStr(TimeHour(TimeCurrent()))+"."+IntToStr(TimeMin(TimeCurrent()))+"."+IntToStr(TimeSecond(TimeCurrent()))+".xls";
file=FileOpen(filepath,"w+");
WHILE NOT FileExist(filepath) DO
END
FileClose(file);
END

在页面上按钮鼠标点击事件中,写下

CreateExcelFile();

保存编译运行,点击按钮就会在项目文件夹下根据系统日期时间创建excel文件了。

posted @ 2021-02-21 20:07  来自金沙江的小鱼  阅读(181)  评论(0编辑  收藏  举报