[CLOSED] remove blank line between report heading and data [EXCEL]
I don't want the line break after heading or subhead for excel report. How can I do this ?
eg. Result: HEADING -------
Col1 Col2 Col3
What I want: HEADING ------- Col1 Col2 Col3This message has been edited. Last edited by: FP Mod Chuck,
WebFOCUS 8.1.05M Windows, Excel , CSV Outputs
December 07, 2017, 04:48 AM
Chaudhary
quote:
I don't want the line break after heading or subhead for excel report. How can I do this ?
Try this code,
TABLE FILE CAR
PRINT
CAR.ORIGIN.COUNTRY
CAR.COMP.CAR
HEADING
"CAR REPORT"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
$
TYPE=TITLE,
COLOR='BLACK',
BACKCOLOR='SILVER',
$
TYPE=HEADING,
JUSTIFY=CENTER,
$
ENDSTYLE
END
Almost everything we do is Excel and I've never seen a blank line between the column titles and the data, headings and data or subheadings and data unless I put one there. The only exception maybe when there is an ACROSS sort element.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
December 07, 2017, 11:39 PM
wyp
When I put the border to heading or data, blank line has been added between the heading and the report data.
With no border:
HEADING Col1 Col2 Col3
With border-bottom: HEADING --------------
Col1 Col2 Col3
I want the output with border-bottom and no blank line between the heading and the report data.
WebFOCUS 8.1.05M Windows, Excel , CSV Outputs
December 08, 2017, 01:12 AM
Chaudhary
quote:
When I put the border to heading or data, blank line has been added between the heading and the report data.
Yes, If you will add border than above code does not work.
We use formatting macros with Excel. I've never gotten borders in WebFOCUS to work the way I want so I do all of my borders in the formatting macro.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
December 10, 2017, 09:44 PM
wyp
>>Mr.jgelona
Is it to run with a macro template? or something ?
Can you give me a some sample code?
WebFOCUS 8.1.05M Windows, Excel , CSV Outputs
December 11, 2017, 09:08 AM
jgelona
ON TABLE PCHOLD FORMAT XLSX TEMPLATE 'yi104.xltm' SHEETNUMBER 1
yi104.xltm is an Excel Macro Enabled Template file. The macro is named 'Auto_Open'. With this name the macro runs automatically when the workbook opens.
Here's the macro
Sub Auto_Open()
Application.ScreenUpdating = False
Application.PrintCommunication = False
For Each ws In Worksheets
With ws
If ws.Name = "Sheet1" Then
' get the number of columns and number of row
ws_last_col = Cells.SpecialCells(xlLastCell).Column
ws_last_row = Cells.SpecialCells(xlLastCell).Row
' rename Sheet1
Sheets("Sheet1").Name = "YI104"
' turn wrap text off for all data starting in row 7 except column 45
Range(Cells(7, 1), Cells(ws_last_row, 44)).Select
Selection.WrapText = False
Range(Cells(7, 46), Cells(ws_last_row, ws_last_col)).Select
Selection.WrapText = False
' set rowheight for column title
Range("A6").Select
Selection.RowHeight = 105
' for all rows starting with the column titles, change all ':' to Line Feed
Range(Cells(6, 1), Cells(6, ws_last_col)).Select
Selection.Replace What:=":", Replacement:="" & Chr(10) & ""
' draw borders
Call borders
' rotate selected column titles 90 degrees
Range("A6,B6,R6,S6,V6:X6,Z6,AE6:AI6,AK6:AN6,AZ6,BG6,BH6").Select
Selection.Orientation = 90
' vertically center and autofit columwidth
Range(Cells(6, 1), Cells(ws_last_row, ws_last_col)).Select
Selection.VerticalAlignment = xlCenter
Selection.Columns.AutoFit
' turn on filters
Range(Cells(6, 1), Cells(6, ws_last_col)).Select
Selection.AutoFilter
' freeze panes
Range("A7").Select
ActiveWindow.FreezePanes = True
End If
End With
Next
Application.PrintCommunication = True
Application.ScreenUpdating = True
End Sub
Sub borders()
Selection.borders(xlDiagonalDown).LineStyle = xlNone
Selection.borders(xlDiagonalUp).LineStyle = xlNone
Selection.borders(xlEdgeLeft).Weight = xlThin
Selection.borders(xlEdgeTop).Weight = xlThin
Selection.borders(xlEdgeBottom).Weight = xlThin
Selection.borders(xlEdgeRight).Weight = xlThin
Selection.borders(xlInsideVertical).Weight = xlThin
Selection.borders(xlInsideHorizontal).Weight = xlThin
End Sub
This is a basic macro, we have many that are far more involved.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.