Missing images in Header/Footer when exporting to Word in SSRS 2008 R2

Question

Carmen W on Wed, 08 Jun 2011 20:10:13


Hi,

I've seen this thread: "http://social.technet.microsoft.com/Forums/en-US/sqlreportingservices/thread/2df47519-2355-4822-976f-65926e49413e"

So based on that, I resized the image appropriately in an image editor, saved it as a JPEG, and then added it into the report as an embedded image. I placed the image into the header of the report and set the display size to Original Size.

I'm still unable to see the image when I export to Word 2007. Export to PDF is working fine. Also the lines that are used to separate the Headers and Footers disappear when I export to Word. Again, working fine when it is exported to PDF.

Help, please! Thanks.

 





Replies

Carmen W on Thu, 09 Jun 2011 13:06:26


I guess I am the only one with this problem?

Anyway, for those that care to know, I have gotten the image part of the problem to work; I was showing it based on an expression so I had to take that out. It seems there is quite a bit of restrictions when exporting to Word with an image in the header, here are the main ones discovered so far:

1. Must be embedded

2. Must be the Original Size (so you can't resize the image in the Report Builder, or whatever development environment you're using)

3. The visibility must be Show (no expressions, and obviously no hide)

I find it quite peculiar that exporting to an Adobe product (PDF) has absolutely no problems, but exporting to a Microsoft product (Word, Excel) has a plethora of formatting issues; seems counter-intuitive. I still have to set the margins manually for the headers when I export to Word (apparently something "by design").

I still have not figured out the cause of the missing line between headers and footers. I assume I have to manually put these in as well, unless anyone can tell me otherwise? :)

 

Tony Chain on Mon, 13 Jun 2011 08:47:09


Hi Carmen,

I am glad to hear that you have solved the image part of the problem. However, based on my testing, we can also use the External or Database image source as well as the Embedded data source, and we can also use other Display Sizing modes besides the Original.

In order to display lines to separate the Headers and Footers, please try to specify the top and bottom borders of report Body by the following steps:

1.    Click the white space in the report Body.

2.    In the properties pane, set both the BorderStyle\Top and BorderStyle\Bottom properties to Solid.

3.    Set both the BorderColor\Top and BorderStyle\Color properties to Black.

For more information about Report Headers and Footers in Exporting to Microsoft Word, please refer to http://msdn.microsoft.com/en-us/library/cc627455.aspx

 

Thanks,
Tony Chain

Carmen W on Mon, 13 Jun 2011 13:58:40


Hi Tony,

I would have to do more tests to check if the other features are indeed working for images in the header, but since it is working fine now, I probably won't be playing with it much. :) In any case, thanks for validating this.

The problem with the solution for the line with the headers and footers is that the lines now also show up on the first page (which is a title page in my case). There is no "Print on first page" option for the body properties, as there is for the header properties. I need to be able to convert to both PDF and Word seamlessly. I can't seem to find any explanation for this in the reference link you provided me, is there any other way around this?

Thanks,

Carmen

 

Riccardo Muti on Tue, 28 Jun 2011 00:45:29


Hi Carmen,

Thanks for creating a Connect bug for this issue: http://connect.microsoft.com/SQLServer/feedback/details/668698/missing-images-in-header-footer-when-exporting-to-word-in-ssrs-2008-r2#details. I've resolved it as By Design, explained the behavior, and provided some solutions. I'll copy my comments here:

"The missing line is simply a current limitation of the Word renderer. The line is a page header/footer border, and the Word renderer does not render borders for the page, body, or page header/footer. There's a simple workaround: instead of a border on the page header, simply add a Line inside the page header. (You could also use a Rectangle for a four-sided border.)

The missing image is due to the expression on the Hidden property, which evaluates to True (hidden) on the first page and False (visible) on all other pages. An important characteristic of Word export that's not necessarily intuitive is that Word - not SSRS - controls pagination. When we export to PDF, the PDF document specifies exactly what content appears on exactly which page, so we can write the page header once for each page and we can evaluate expressions like your Hidden expression on a page-by-page basis. When we export to Word, however, the Word document simply specifies the content for the entire document, and Word is responsible for paginating the content. We write the page header only once for the entire document, so we can evaluate the Hidden expression only once for the entire document. In your repro, you don't actually need to use an expression to hide the image on the first page since you have PrintOnFirstPage = False for the page header anyways, so you can just leave Hidden = False."

Hope that helps.

a_27 on Tue, 22 May 2012 19:48:08


Has anyone found any workaround to this limitation of Word? In my case, I do need to print or not print various pages in the report, depending on the value of the Globals!PageNumber. We are printing in one rdl three copies of the same letter, but each with its own cover letter. So the first page of the cover letter and of the main letter always have a larger logo and complete return address. The following pages only have a smaller logo and date.As Carmen said, this works fine for pdf, but not for Word. We must be able to export to both--but specially to Word. Thank you!

PS This should not be resolved as By Design. It may be a limitation of Word, but then another answer must be found for SSRS. Another solution would be to move everything from the header to the rdl body. But I cannot use an expression involving Globals!PageNumber except in the header!

I would very much appreciate any suggestions anyone can offer me!

Bupbetainang on Fri, 10 Jan 2014 04:18:03


I think your image is too large, you try to redue its size and see the result. It works fine for me now