awalker89/openxlsx

Feature request - Add print areas and PrintTitleColumns

Closed this issue · 2 comments

These features are present in VBA, to the people who know it it's ok, but for the rest of us, it would be awesome to have it all with R.

This is an example with VBA code. As you see there are printTitleColumns and PrintArea (multipage A3), the main features request.

Sub print_area()
    Dim ws As Worksheet
    
    For Each ws In ActiveWorkbook.Worksheets
        With ws.PageSetup
            .PrintTitleColumns = "$A:$E"
            .PrintArea = "$F$1:$AF$125,$AG$1:$BE$125,$BF$1:$CD$125,$CE$1:$DA$125,$DB$1:$DX$125" ' there will be one area between the upper left and lower right cells
            Debug.Print .PrintArea  ' check the final .PrintArea; prints $F$1:$DX$125
            .Zoom = False
            .Orientation = xlLandscape
            .FitToPagesWide = False 'it's Auto
            .FitToPagesTall = 1
            .CenterHorizontally = True
            ws.ResetAllPageBreaks
            breaks = Array("AF1", "BE1", "CD1", "DA1", "DX1")   'zero-based array
            For i = 1 To UBound(breaks)
                ws.VPageBreaks.Add Before:=ws.Range(breaks(i - 1)).Offset(, 1)
            Next
        End With
    Next
End Sub

Thanks.

ycphs commented

Could you please create an issue at ycphs/openxlsx?

This is the active fork of the package.

It's already created there. I will close this. Tkz.