External Links to Images in Base Reports?

I have worked out the matter of putting links into Forms so that photos can be referenced from OUTSIDE the database using a text field in a table. However, I am not finding the same capability in the Reports module. The only suggestions I’ve found so far are to embed the images in a table and then use that to put images into the Report. This seems to defeat the purpose since (in my experience anyway) the database gets unstable with a bunch of photos. There would be about 160 jpg photos in this database. So I’m interested in determining if the external links can be made to work with Reports. If not, then I will probably have to find a totally different tool for this database. The database is for an organization that my wife is part of and she volunteered me (!) to do this database for them. Nice, huh?? :slight_smile:

Thank you very much! Any suggestions are very much appreciated.

Bob Harris

Some questions:

  1. Perhaps you might explain the exact steps you have tried using linked images in the RB module.
  2. Do you get (Java) errors when running the report?
  3. What computer platform are you using?
  4. Do your reports run with images from other sources (such as single fixed images or images stored in your database)?

NOTES: The RB’s tools and interface is a bit different from those available in FORMS. There seems to a bug using image controls in reports affecting Mac OSX - see HERE. Not sure if it affects other platforms.

The bug mentioned above for Mac OSX no longer applies in 4.2.x or 4.3.x

You can insert a graphic in a report by setting the data field to a text field that contains an URL. I just tested this on my Windows 7 computer with LibreOffice 4.1.4.2.

The table or query that the report is based on should contain a text field (a VARCHAR_IGNORECASE field worked for me, but it may not if your operating system uses case-sensitive file paths) that contains the URL of the image. If the photo is on your local computer (e.g. on Windows: D:\Documents\ben.png) the URL should have the file:/// prefix, and backslashes replaced by forward slashes. In my example I put file:///D:/Documents/ben.png in the database field. You can also point at online URLs starting with http://.

To include the image in your report, insert an Image Control (Insert menu > Report Controls > Graphic…). On the Data tab in the properties of the control, choose Field or Formula as Data Field Type and the column name containing the URL as Data Field.

In my quick test, I was able to produce this report:

image description

Note that the images (in my case a local PNG and an external GIF) are stretched to the dimensions of the control, so you want to use photos that have been cropped to a single ratio that matches the ratio of the control’s dimensions.

bencomp: Thanks for your answer. Unfortunately, it does NOT work on my Mac OSX.6.8 - I just get a screen with a lot of Java errors. I note using linked images in a FORM does not require the full file-path (just the image filename if it’s in the same directory as the database).

Could you add details about your OS and LO version to the question? Oh, wait, it’s not your question :slight_smile:

What kind of Java errors do you get? I hadn’t tried relative file paths, but interesting to know that could work too.

I’m using LO version 4.1.4.2. The same problem occurs for AOO version 4.
Java errors (below):

    OpenOffice Base The document "Report1 could not be opened.

Oni_uno bridge error] UNO calling java method execute: non-UNO exception occurred: java.lang.NoClassDefFoundError: Could not initialize class java.aw1.Dimension
java stack trace: java.lang.NoClassDefFoundError: Could not initialize class java.awt.Dimension
at
com.sun.star.report.SOImageService.getImageSize(SOImageService.java:88)
at
com.sun.star.report.SOImageService.getImageSize(SOImageService.java:135)
at
com.sun.star.report.pentaho.output.ImageProducer.produceFrom URL(ImageProducer.java:431)
at
com.sun.star.report.pentaho.output.ImageProducer.produceFromString(ImageProducer.java:381)
at
com.sun.star.report.pentaho.output.ImageProducer.produceImage(ImageProducer.java:206)
at
com.sun.star.report.pentaho.output.OfficeDocumentreportTarget.startImageProcessing(OfficeDocumentReportTarget.java:1263)
at
com.sun.star.report.pentaho.output.text.TextRawReportTargeStartOther(TextRawReportTarget.java:549)
at
com.sun.star.report.pentaho.output.OfficeDocumentreportTarget.startElement(OfficeDocumentReportTarget.java:712)
at
com.sun.star.report.pentaho.layoutprocessor.ImageElementLayoutController.generateImage(ImageElementLayoutController.java:118)
at
com.sun.star.report.pentaho.layoutprocessor.ImageElementLayoutController.delegateContentGeneration(ImageElementLayoutController.java:95)
at
com.sun.star.report.pentaho.layoutprocessor.AbstractReportElementLayoutController.advance(AbstractReportElementLayoutController.java:131)
at
org.jfree.report.flow.AbstractReportProcessor.processReportRun(Unknown Source)
at
org.jfree.report.flow.SinglePassreportProcessor.processReport(Unknown Source)
at
com.sun.star.report.pentaho.PentahoReportjob.execute(PentahoRe portjob.java: 374)
at
com.sun.star.report.pentaho.SOReportJobFactory$_SOReportJobFactory.execute(SOReportJobFactory.java:223)

Oh boy, that is ugly. You should file a bug report for it. My first thought is that java.aw1.Dimension contains a typo (‘1’ instead of ‘t’), but others should have a look. Do you have Oracle JRE 7 update 45?

It would be a bit strange that LibreOffice 4.1.4.2 for Windows and Mac to have different code bases, but it looks like they do.

You’re right about my typo (the actual listing does say ‘t’). Will follow-up the existing bug report. Hope it gets fixed soon - we don’t want Mac users being treated as second-class citizens!

They already are second class citizens where LibreOffice is concerned.