SOLVED

Report - Image Background in preview grey

Copper Contributor

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? 

14 Replies

@MikkoRiese 

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.

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. 

@MikkoRiese 

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. 

GeorgeHepworth_0-1702223086219.png

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.  

 

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:

MikkoRiese_3-1702267283357.png

 

In the report view everything looks nice

MikkoRiese_1-1702267222395.png

 

But in the preview it does not. And the problem is that the preview is how it looks as pdf.

MikkoRiese_2-1702267222399.png

 

@MikkoRiese 

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? 

 

The sub report is not visible in the preview. As it contains no data, but it is vible in the report view. This is ok.

I use png format.
I will try to hide the image box if no image is there.
I let you know if it works.
best response confirmed by MikkoRiese (Copper Contributor)
Solution
Thanks. I am also going to ask a colleague who is much more involved with managing images to take a look at this problem.
I tried it and it works like charme.
Thanks a lot

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,

MikkoRiese_2-1702475676772.png

 

as well as because Data come from different tables and querys.

Therefore the images are placed in the header part of the first group.

MikkoRiese_0-1702475620696.png

 

and then i have a gray background

 

If i just create a test report where i place the image in the detail section

MikkoRiese_3-1702475699677.png

 

then the background is white

MikkoRiese_4-1702475719563.png

 

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?

Hello
i removed all the grouping from the report (as a copy report).
And now the pictures look as they should.

But now the data of the sub-reports can not be hold together.

Do you know if i can disble page breaks via vba?
Then i could place page breaks between the subreports and disable them depending of the amount of data within the subreports
You're exploring an aspect of reports of which I am not particularly knowledgeable. It sounds like there is something going on in the background of the report sections themselves.

I won't have time to explore until later today.

Maybe you could try to use a group header with nothing in it, and the images in the detail section to manage the page breaks.
Thanks for your help and time.
I think grouping with nothing in it will not help.
THe images have to come in the first section, followed by a lot of sub-reports.
So i would need the detail section to be the first section.

But maybe i can use grouping inside the sub reports.
I think that should do it.

I am very thankfull for your advise.
I will try it this way and report later.
So do not spend time on this, as i think i will get it to work.
Thanks a lot again
Hello,
i found a solution.
I can set the pagebreak to visible=false.
This disables the page break.

Now i "only" have to some calculations based on the size of the sub reports to enable or disable pages breaks between the sub reports
Congratulations on becoming an expert on Access reports.

Continued success with the project.
1 best response

Accepted Solutions
best response confirmed by MikkoRiese (Copper Contributor)
Solution
Thanks. I am also going to ask a colleague who is much more involved with managing images to take a look at this problem.

View solution in original post