Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 279

Advertising
background image

9

ReportsPlus

279

Excel.Workbook.Properties.Status = "Status goes here"

Excel.Workbook.Properties.LastModifiedBy = "Last

modified by"

Excel.Workbook.Properties.Company = "Company Name"

Excel.Workbook.Properties.Manager = "Manager Name"

' Create and set some custom properties of the Excel

workbook.

Excel.Workbook.CustomProperties.Add

("ACustomStringProperty", "String property")

Excel.Workbook.CustomProperties.Add

("ACustomDateProperty", DateTime.Now)

Excel.Workbook.CustomProperties.Add

("ACustomNumberProperty", 123.456)

' Populate values and strings in empty cells in a sheet
of the workbook

worksheetName = "Single Cell Population"

Excel.SetCell(worksheetName, 11, 1, "This is a string")

Excel.SetCell(worksheetName, 17, 1, 123456.78)

Excel.SetCell(worksheetName,

"SimpleDataPopulation_NamedRange1", "This is a named
range")

' Populate daily meter data a sheet of the workbook

' - and the data is then used to fill a bar chart

worksheetName = "Daily Energy Bar Chart"

meter = Report.Meters(0)

Excel.SetCell(worksheetName, 20, 1, meter.Name)

row = 22

For Each day in Report.Days

startdate = day.StartDate

kwh = meter.Total(ValueType.RealEnergyNet,

Day.StartDate, Day.EndDate)

Excel.SetCell(worksheetName, row, 1,

startdate.ToString())

Excel.SetCell(worksheetName, row, 2, kwh)

row = row + 1

Next day

End Sub

Advertising