I have code that adds vertical lines in a report to create an "excel like" table or sorts. When doing a print preview all is well and the report formats correctly. However, when saving directly to PDF the formatting is lost. Here is my code (not sure if this helps). This code also makes use of (2) classes and I can include those as well if needed.
Code to add vertical lines - in the reports GroupHeader On Print event:
Code to print to PDF directly:
How can I print direct to PDF and retain the formatting?
Any help appreciated.
Code to add vertical lines - in the reports GroupHeader On Print event:
Code:
Dim lns As Lines Dim lngHeight As Long Dim ctl As Control Set lns = New Lines 'create new Lines collection Set lns.Parent = Me 'set reference to current report lns.Add 0 'add line to far left For Each ctl In Me.GroupHeader0.Controls 'loop through controls in detail section If ctl.Height > lngHeight Then lngHeight = ctl.Height 'find tallest control 'If ctl.ControlType = acTextBox Then lns.Add (ctl.Left + ctl.Width) 'add a line to the right of each text box If ctl.Tag = "vert" Then lns.Add (ctl.Left + ctl.Width) 'add a line to the right of each text box Next lns.Lengths = lngHeight 'Set all line heights to the tallest control's height lns.Draw 'draw lines Set lns = Nothing Set ctl = Nothing
Code:
DoCmd.OutputTo acOutputReport, "rptIndivSurveySec", acFormatPDF, MyFilename, False, , , _ acExportQualityPrint
Any help appreciated.
Comment