none
No headers or footers apearing in Word export (Upgraded 2008 ReportViewer to 2010) RRS feed

  • Question

  • Hi There,

    I am using local reports against objects.  I have upgraded report viewer in my application from 2008 to 2010.  I have local reports developed under 2008 which export fine to Excel and PDF but when using the new Word export the reports seem to lose the headers and footers.

    Just wondering if this is a known issue or easy fix.

    Thanks,

    Perter

    Monday, November 15, 2010 8:14 PM

Answers

  • Hi Riccardo,

    I have narrowed it down to an expression I am using.  Because I have a title page that is shown or hidden based on user input, the header and footer each have a rectangle object that will hide or show based on user preference.  So, I have a rectangle with an expression for Visibilty.  The expression is as follows:

    =Iif(CBool(Parameters!MRO_IncludeTitlePage.Value) And Globals!PageNumber=1,True,False)

    I think the expression is evaluated correctly but Word takes whatever it is for the first page and uses that for the rest of the document.  I am wondering if you may know another way to accomplish this that Word may understand.  The only workaround I can think of is to have two duplicate reports:

    - one with the title page removed showing headers and footers always

    - the other has the title page but uses the 'Print on first page' flags set to off in the report properties.

    I am really hoping I will not have to maintain 2 identical reports so if you have any other suggestions I would love to hear them.

    Sorry I did not realize the issue earlier but this works fine for Excel and PDF exports so it threw me off a bit.

    • Marked as answer by Perter Monday, November 22, 2010 4:00 PM
    Friday, November 19, 2010 4:44 PM
  • For anyone with Word export issues, this link may be helpful:

    http://msdn.microsoft.com/en-us/library/cc627455.aspx

    I had a hard time finding this detail but it may help to diagnose some Word exporting issues.

    • Marked as answer by Perter Monday, November 22, 2010 4:01 PM
    Friday, November 19, 2010 4:55 PM

All replies

  • Could you submit a bug on Microsoft Connect (http://connect.microsoft.com/sqlserver) and attach a report that reproduces the issue?

    Friday, November 19, 2010 1:41 AM
  • Hi Riccardo, thanks for the reply.  I just discovered that if I have no headers/footers on the first page, then the export to Word shows none.  If the first page has headers/footers than they do export.  In my case I have a tiltle page for the report that the user can hide or show and without the title page the headers/footers come through.  This is a huge report with numerous subreports and parameters and code behind; I will try to build a simpler example to duplicate the problem.

    Friday, November 19, 2010 3:42 PM
  • Hi Riccardo,

    I have narrowed it down to an expression I am using.  Because I have a title page that is shown or hidden based on user input, the header and footer each have a rectangle object that will hide or show based on user preference.  So, I have a rectangle with an expression for Visibilty.  The expression is as follows:

    =Iif(CBool(Parameters!MRO_IncludeTitlePage.Value) And Globals!PageNumber=1,True,False)

    I think the expression is evaluated correctly but Word takes whatever it is for the first page and uses that for the rest of the document.  I am wondering if you may know another way to accomplish this that Word may understand.  The only workaround I can think of is to have two duplicate reports:

    - one with the title page removed showing headers and footers always

    - the other has the title page but uses the 'Print on first page' flags set to off in the report properties.

    I am really hoping I will not have to maintain 2 identical reports so if you have any other suggestions I would love to hear them.

    Sorry I did not realize the issue earlier but this works fine for Excel and PDF exports so it threw me off a bit.

    • Marked as answer by Perter Monday, November 22, 2010 4:00 PM
    Friday, November 19, 2010 4:44 PM
  • For anyone with Word export issues, this link may be helpful:

    http://msdn.microsoft.com/en-us/library/cc627455.aspx

    I had a hard time finding this detail but it may help to diagnose some Word exporting issues.

    • Marked as answer by Perter Monday, November 22, 2010 4:01 PM
    Friday, November 19, 2010 4:55 PM
  • Hi Perter,

    The nature of the page header is quite different across these formats. In Excel, each logical page break starts a new worksheet, and we're free to define a different header on each worksheet. In PDF, we're free to define a different header on each page. In Word, however, we must define a page header for an entire section.

    There are a couple of exceptions, one being that Word allows you to select "Different First Page" and have a different header on the first page. Meanwhile, in SSRS, if you set PrintOnFirstPage = False on the page header, the Word renderer will use this feature. Normally, that enables this scenario of hiding the header on the first page. The complication is that you want to do so conditionally based on a report parameter, which would require setting PrintOnFirstPage to an expression, which isn't possible, unfortunately.

    Another way to define different page headers in Word is to divide your document into different sections. SSRS actually has a little-known feature called Report Sections, which the Word renderer does translate to Word sections. However, it's available only in SQL Server 2008 R2, not in SQL Server 2008 or ReportViewer 2010, and even R2 has no designer support for them, so as soon as you add multiple sections, you lose the ability to open your reports in designer tools.


    Program Manager, SQL Server Reporting Services
    Sunday, November 21, 2010 4:03 AM
  • Hi Riccardo,

    So for now I will have to maintain 2 reports; one with a title page and one without.  For us we only use Reportviewer local reports against objects; SQL Server is not used.

    As developers we can understand the technical challenges on your side getting reports exported to different packages such as PDF, Excel and Word as they certainly handle things differently. 

    We are however users of the reportviewer control and without some of the insight to how the export works internally we naturally assume the export function will handle translating from our reports into the correct pieces on the other side.  If there are limitations (as there are with many integrations) keep in mind the limitations may not apparent to the end users - I really had a hard time finding these facts even when I ran into issues.  That is why I have included the link above as it does seem to outline some of the 'gotchas' exporting to Word.  None of my searches brought up this link; I happened across it reading another issue.  Perhaps it should be added to 'gotreportviewer.com' or blogged about by one of your team members.  In fact the Header / Footer help section for that link is incomplete; the example is missing.  I sent feedback to the documentation site to point that out as well.

    In the end I am glad we have an export to Word as this is functionality my users have been wanting for a long time. 

    Thanks for the help, Perter

    Monday, November 22, 2010 3:59 PM