Udostępnij za pośrednictwem


Refreshable Reports in Word, PowerPoint, Excel

Microsoft Office supports several ways of embedding images into Office documents:

  • Insert – statically inserts a copy of an image into the document.
  • Link – creates a virtual connection with that image without actually embedding it in the document.
  • Insert and Link – insert a copy of the image, and also stores the link to the image so that it can be refreshed later (e.g. when re-opening the document, or when pressing F9). 

Using this approach, you can embed a (refreshable) image of a report rendering into an Office document.  Reporting Services supports Url Access to render reports, which we are going to use to create a Url that renders the report using the Image renderer and specifying device info parameters to render to PNG format.

For example, publish the attached report to the root folder of your report server, and enter the following url as one line into a browser:

https://HostName/Reportserver?
%2fEmployee+Sales.2008
&RS:Command=Render&RS:Format=Image
&RC:OutputFormat=PNG

The first line of the url above represents the report server address. The second line is the full path to the report.  The third line instructs the report server to render the report as image. The final line determines the image format.

After you created and verified the url renders the report successfully to an image, you can insert an image to your Office document, enter the url as file name, and use the “insert and link” option.

image

Using the insert and link option, you should get a report rendering of the first page of the report embedded into the Office document.  The image will refresh by updating the document using the F9 option, or automatically next time you open the document in Office.

Report embedded as refreshable image in Word 

image

Caveat: Reporting Services image rendering uses physical page size information specified in the report. The report renders according to the page & margin settings defined in the report - you may want to optimize the report design as shown in the screenshot on the right hand side.  Alternatively, override the page margin settings and the page size settings at runtime, by specifying the deviceinfo arguments for RC:MarginLeft, etc. 

For example:
https://HostName/Reportserver ?
%2fEmployee+Sales.2008
&RS:Command=Render
&RS:Format=Image&RC:OutputFormat=PNG
&RC:MarginTop=0&RC:MarginLeft=0&RC:MarginBottom=0&RC:MarginRight=0

If you want to render a different page than the first page of the report, use the RC:StartPage device info to specify the desired page number.

Employee Sales.2008.rdl