資源簡介
Wincc自動生成excel的c腳本,已在wincc7.0版本上測試完畢。
代碼片段和文件信息
/////////////////////////全局腳本-時間觸發-每60分鐘觸發一次///////////////////////////////////////////////?
#include?“apdefap.h“
int?gscAction(?void?)
{
#pragma?option(mbcs)
//?WINCC:TAGNAME_SECTION_START
//?syntax:?#define?TagNameInAction?“DMTagName“
//?next?TagID?:?1
//?WINCC:TAGNAME_SECTION_END
//?WINCC:PICNAME_SECTION_START
//?syntax:?#define?PicNameInAction?“PictureName“
//?next?PicID?:?1
//?WINCC:PICNAME_SECTION_END
?
#pragma?code(“kernel32.dll“)
void?GetLocalTime(LPSYSTEMTIME?lpSystemTime);
#pragma?code()
int?cnt;//行
char?FileName[100]=““;
char?Date[20]=““;
SYSTEMTIME?sysTime;
__object?*?pExcel=NULL;
__object*??fso=NULL;
GetLocalTime(&sysTime);
sprintf(FileName“E:\\Reports\\陽光棚\\陽光棚-%d-%d-%d.xls“sysTime.wYearsysTime.wMonthsysTime.wDay);//文件名?
sprintf(Date“%d-%d-%d“sysTime.wYearsysTime.wMonthsysTime.wDay);//記錄日期?
pExcel=__object_create(“Excel.Application“);
pExcel->Visible=0;
fso=__object_create(“scripting.FileSystemobject“);
cnt=sysTime.wHour+4;//根據采集時間小時+偏移量=Excel記錄行號?
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(!fso->FileExists(FileName))//文件存在
{
????????pExcel->Workbooks->Open(“E:\\Reports\
- 上一篇:NetBackup8.0安裝包
- 下一篇:矩陣求逆高效完整C代碼
評論
共有 條評論