Dec 09 2023 11:21 PM
Hello,
i have a report where i want to display different images.
While it looks nice in the report view, the background in preview (and therewith in the pdf) is grey in the region not filled by the image. So if there is no image than the whole field is grey.
Any idea how i can make the preview look the same as the report view?
Dec 10 2023 06:28 AM - edited Dec 10 2023 06:29 AM
It depends in part on why there is no image in certain situations. How are you selecting the different images?
Reports have events which fire in Print Preview and Print, but not in Report view. One of them might be used to make the image control visible or not visible, according to whether there is an image in the image control, but we need a bit more detail to sort out a way to take advantage of that.
Dec 10 2023 07:25 AM
Hello @George_Hepworth ,
thanks for the quick answer.
Images are direcly stored in the table.
Not only if there is no image the whole image box is grey, but also if images are smaler the part where no image is, is grey.
If the picture box would be invisible it stil should be white as the whole background is white.
Dec 10 2023 07:52 AM
Thanks, I'll reserve comment on storing images in tables inside an accdb for the moment.
Here's where you should be able to change the background for the image control in which the images display.
You can change the background style and background color. Here I used White, which is hex code #FFFFFF but you can change it as you choose.
If that isn't sufficient to change the appearance as you need, maybe we'll have to look at the accdb to see what else could be related.
Now, storing images in tables in Access.
Images are large enough to cause the overall size of an accdb to grow much more than the same data with no images. It can cause the accdb to bloat to the point where it becomes unusable. For that reason, most experienced developers have learned to avoid this approach except when the number of such images is quite small and not likely to change over time. Maybe a handful of company logos for reports, for example.
There are other approaches which are more efficient, albeit they require more planning and more work to implement. However, the extra effort is generally well worth while. If you want to look at an example, there is a downloadable sample here on my website.
Dec 10 2023 08:01 PM
Good morning @George_Hepworth ,
i normally do not store the images directly in the database. But this is how the customer wants it to be. And it is an sql server as backend. The number of images will stay below 500-600. At the moment these are roughly 300.
I used the same settings as you did:
In the report view everything looks nice
But in the preview it does not. And the problem is that the preview is how it looks as pdf.
Dec 11 2023 04:51 AM
Ah, you didn't mention that the Back End is in SQL Server.
The only other thing I can think of would be to use the Format event of the report section where the image control is. You can make the image control visible or not visible, depending on whether there is an image in the image control.
In the screenshots, there are other display differences between the report view and print preview appearance of the images.
What image format is used? jpg, png or something else?
Dec 11 2023 05:56 AM
Dec 11 2023 06:04 AM
SolutionDec 11 2023 08:03 AM
Dec 13 2023 05:57 AM
Hello @George_Hepworth
I still have the problem that the background for some images is grey.
I tried to just save the path to the images in the server, but this did not make any difference.
But i found another issue, that may cause the problems.
In the report i have to use multiple subreports and grouping to keep parts together,
as well as because Data come from different tables and querys.
Therefore the images are placed in the header part of the first group.
and then i have a gray background
If i just create a test report where i place the image in the detail section
then the background is white
Any idea why the image is displayed wrong in the header section and not in the detail section.
Or is there a way to keep subreport data togehter without using grouping?
Dec 13 2023 06:20 AM
Dec 13 2023 07:42 AM
Dec 13 2023 08:49 PM
Dec 13 2023 09:30 PM
Dec 14 2023 05:58 AM
Dec 11 2023 06:04 AM
Solution