update formatsummarytables to include new tables
This commit is contained in:
@@ -176,11 +176,13 @@ Sub FormatSummaryTables()
|
|||||||
Dim rangeStart As Long, rangeEnd As Long
|
Dim rangeStart As Long, rangeEnd As Long
|
||||||
Dim categories() As String
|
Dim categories() As String
|
||||||
Dim lastCol As Long
|
Dim lastCol As Long
|
||||||
|
Dim headerText As String
|
||||||
|
|
||||||
oDoc = ThisComponent
|
oDoc = ThisComponent
|
||||||
oSheet = oDoc.Sheets.getByName("Summary")
|
oSheet = oDoc.Sheets.getByName("Summary")
|
||||||
|
|
||||||
categories = Array("Temp", "Wind", "Rel Humidity", "Avg Total Liquid Precipitation", "Rainy Days")
|
' Updated categories list
|
||||||
|
categories = Array("Temp", "Wind Speed", "Wind Direction", "Rel Humidity", "Avg Total Liquid Precipitation", "Rainy Days", "Solar Radiation")
|
||||||
outRow = 0
|
outRow = 0
|
||||||
|
|
||||||
For i = LBound(categories) To UBound(categories)
|
For i = LBound(categories) To UBound(categories)
|
||||||
@@ -204,20 +206,28 @@ Sub FormatSummaryTables()
|
|||||||
cell = oSheet.getCellByPosition(j, outRow)
|
cell = oSheet.getCellByPosition(j, outRow)
|
||||||
cell.CharWeight = com.sun.star.awt.FontWeight.BOLD
|
cell.CharWeight = com.sun.star.awt.FontWeight.BOLD
|
||||||
cell.IsTextWrapped = True
|
cell.IsTextWrapped = True
|
||||||
cell.CellBackColor = RGB(255, 173, 0) ' #FFAD00 orange
|
cell.CellBackColor = RGB(255, 173, 0) ' orange
|
||||||
cell.HoriJustify = com.sun.star.table.CellHoriJustify.CENTER
|
cell.HoriJustify = com.sun.star.table.CellHoriJustify.CENTER
|
||||||
cell.VertJustify = com.sun.star.table.CellVertJustify.BOTTOM ' <-- changed
|
cell.VertJustify = com.sun.star.table.CellVertJustify.BOTTOM
|
||||||
Next j
|
Next j
|
||||||
|
|
||||||
' Data rows formatting
|
' Data rows formatting
|
||||||
rangeStart = outRow + 1
|
rangeStart = outRow + 1
|
||||||
rangeEnd = outRow + 12 ' assuming 12 months data rows
|
rangeEnd = outRow + 12 ' 12 months
|
||||||
|
|
||||||
For iRow = rangeStart To rangeEnd
|
For iRow = rangeStart To rangeEnd
|
||||||
For j = 0 To lastCol
|
For j = 0 To lastCol
|
||||||
cell = oSheet.getCellByPosition(j, iRow)
|
cell = oSheet.getCellByPosition(j, iRow)
|
||||||
cell.HoriJustify = com.sun.star.table.CellHoriJustify.CENTER
|
cell.HoriJustify = com.sun.star.table.CellHoriJustify.CENTER
|
||||||
' No rounding here — NumberFormat is inherited from source
|
|
||||||
|
' === Optional: convert Solar Radiation from ly/day to kWh/m²/day ===
|
||||||
|
If categories(i) = "Solar Radiation" And j > 0 Then
|
||||||
|
If cell.Type = com.sun.star.table.CellContentType.VALUE Then
|
||||||
|
cell.Value = cell.Value * 0.011622
|
||||||
|
' Optional: set number format to show 3 decimal places
|
||||||
|
cell.NumberFormat = oDoc.NumberFormats.queryKey("0.000", oDoc.getLocale(), True)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
Next j
|
Next j
|
||||||
Next iRow
|
Next iRow
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user