Xojo Reports Do Not Look The Same Cross-platform

Hi,

I have been working on a cross platform app for about 2 1/2 years now. I use Xojo Reports in quite a few areas. I am developing on a Mac. The reports look okay when you run them on a Mac. BUT, today I tested my app on a Windows 7 machine and the reports look awful. The report does NOT print in the center of the page and the results look like a printed the report on a dot matrix printer. It looks terrible, a picture that looks great when printed on a Mac looks completely distorted. The type runs all together and fields overlap each other, blocking areas of text off.

Its just unacceptable. What the heck am I doing wrong to have such night and day differences between the Mac and Windows reports??? Its very upsetting that I have spent so much time on these reports and although they look great when printed on a Mac they look awful when printed on a windows machine. I’m really hoping this is something I’m doing wrong and not Xojo. Any help would be greatly appreciated.

Jim

Probably a difference in printer resolution and/or font. How are you selecting the resolution?

Hi Tim,

I don’t know. Where do you select the resolution? For the font, I use the System font.

You set it (request it, really) in the PrinterSetup object that you pass to Report.Run.

dim ps as new printersetup
ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300

This is the code I was using for opening the PageSetupDialog.

[code] If ps.PageSetupDialog Then
Dim g As Graphics
g = OpenPrinterDialog(ps, Nil)
If g <> Nil Then

  // if the report runs successfully
  If rpt.Run(rsq, ps) Then
    rpt.Document.Print(g)
  End If
End If

End If[/code]

I think I should be using the Printersetup instead of the PageSetup. I changed it to that and added your code and it looks better. I will mess around with it tomorrow and see if I can get it going better.

Thanks a lot Tim. You’re great!

You need just one small change.

If ps.PageSetupDialog Then
    // request better resolution
    ps.MaxHorizontalResolution = 300   // or use -1 for maximum supported
    ps.MaxVerticalResolution = 300     // or use -1 for maximum supported
    //
    Dim g As Graphics
    g = OpenPrinterDialog(ps, Nil)
    If g <> Nil Then
      
      // if the report runs successfully
      If rpt.Run(rsq, ps) Then
        rpt.Document.Print(g)
      End If
    End If
    
  End If

Edit (Paul): Added closing [code] tag

That he is, always helpful.

It still is not working correctly when I run the report under Windows. When you try to print it, the entire report is shifted down and to the right which cuts off the bottom and right sides of the report. The margins are not correct.

Just for the heck of it, I tried running the Xojo Example - Gas Report and I get the same results. Even Xojo’s own example does not seem to work correctly. What am I missing? Is there a problem creating an app on a Mac and deploying it on Windows ?

I replaced the ps.PageSetupDialog with Printersetup and it seems to work better. So I replaced Tim’s code above with this code:

dim rsq as new Reports.RecordSetQuery(rs)

dim ps as new printersetup
ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300

Dim g As Graphics
g = OpenPrinterDialog(ps, Nil)
If g <> Nil Then

// if the report runs successfully
If rpt.Run(rsq, ps) Then
  rpt.Document.Print(g)
End If

End If

The problem still exists that the Windows output and the Mac output look different. The type is smaller on the Mac report than it is on the Windows report, and the margins are narrower on the Windows report than they are on the Mac report.
It seems that the actual printout on the Windows matches the Xojo layout better than the Mac version. As I said the margins are larger and the type appears smaller on the Mac versions.

Is there a way to adjust the margins of the report in the printer code above? Anyone know how to make them look the same when they print? Any help would be appreciated.

James

We ran into similar problems with every printer option that we could find and finally resorted to using DynaPDF as our cross platform option. Because we are generating reports to PDF, they are consistent on both Mac and Windows. Virtually identical.

Of course, this means that reports have to coded rather than designed in the banded report writer, but then you have much greater flexibility.

It’s not an easy option to implement, but our applications necessitated that our reports be consistent regardless of the OS and this was the only option that actually worked.

Of course, if you’re only Mac or only Windows, then this may be overkill, but that depends on your needs.

Thanks John for the suggestion. I am just working with Mac and Windows, and I really need the customer to just be able to print it right from the app. There seems to be a whole bunch of problems with the Xojo Report that I wish they would fix. Its seems like these problems just drag on from one update to another without any attention.

Margins are a tough one because they’re determined by the printer and the driver. I’ve even seen cases where the same printer allows different margins on different platforms, which is crazy when you realize that minimum margins are supposed to be determined by the physical capabilities of the device, and not some arbitrary number.

I ended up feeling this same situation so I rolled my own. I have to give Xojo major props because subclassing canvas’ and using dynamic arrays of container controls really unleash the power of Xojo. Yes it took time, but it was worth it for me.



I used MBS Chart Director for the nice graphics.

Only the pie charts :slight_smile:

CORRECTION (Thank you Richard for pointing that out) I used MBS Chart Director for the chart images. I used Richard Summers UI design consulting for the custom graphics and overall UI layout.
http://www.dev101.co.uk/