C-Action+打印布局可以完成WinCC的很多需求。
其实用VBS也可以做到打印,不过需要借助外部对象:定义一个Excel应用对象,这个对象可以指定一个Excel文件与之关联,这样就可以实现类似WinCC的布局调用功能,操纵Excel对象不但可以打印报表,满足部分国企对报表的格式需要,还可以将数据另存为文件。
如下为一段简单Excel程序参考:
Dim objExcelApp
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Visible = True
'
'ExcelExample.xls is to create before executing this procedure.
'Replace
with the real path of the file ExcelExample.xls.
objExcelApp.Workbooks.Open "\ExcelExample.xls"
objExcelApp.Cells(4, 3).Value = ScreenItems("IOField1").OutputValue
objExcelApp.ActiveWorkbook.PrintPreview
objExcelApp.Workbooks.Close
objExcelApp.Quit
Set objExcelApp = Nothing