Child pages
  • View File Macro
Skip to end of metadata
Go to start of metadata

The view file macro allows you to embed an Office or PDF document into your Confluence page. First attach the document to a wiki page and then use the view file macro to display the document's content.

When viewing the page, users will see the content of the Office document. Users do not need to have Office installed, in order to see the content of the Office document.

Where applicable, users will be able to open the document for editing in their Office application.

This is just one of the ways Confluence can interact with Office documents. For an overview of all Office Connector features, please refer to Working with the Office Connector.

The view file macro provides several unique parameter options for some of the types of files it handles. Hence, to simplify its use, the view file macro is separated into the following four macros in the macro browser:

On this page:

Basic Usage without the Macro Browser

To use the view file macro without the macro browser, enter it directly in the Wiki Markup or Rich Text editors based on one of the following examples, along with any parameters (described below) that suit the type of file.

{viewdoc:name=my document.doc}
{viewppt:name=my presentation.ppt}
{viewxls:name=my spreadsheet.xls}
{viewpdf:name=my document.pdf}

{info:title=Editing 'older style'

Error rendering macro 'viewfile'

com.atlassian.confluence.macro.MacroExecutionException: com.atlassian.confluence.macro.MacroExecutionException: No attachment name specified

macros}
In Confluence 3.0, the {viewfile} macro's syntax was changed to be file type-specific (as indicated by the examples above). If your Confluence site was upgraded to Confluence 3.0 and you had existing content which used the 'older style' syntax for this macro ({viewfile}), you can still edit these macros via the macro browser. Just place your cursor inside the viewfile macro's braces and click the macro browser icon to edit it. The 'edit only' version of the view file macro will open in the macro browser, allowing you to edit its specific parameters.

Example of Usage

The live example below shows how to display an Excel spreadsheet on a Confluence page. The Excel spreadsheet is attached to this documentation page.

What you need to type

What you will get

{viewxls:name=my spreadsheet.xls}

Loading

Prerequisites for Viewing and Displaying Office Documents

Unknown macro: {hide}

The entire content of this page is included into other pages via the {include} macro.

If you want to make use of the View File macro or to view Office files attached to a wiki page, you need the setup described below.

Browsers and Flash Player

You can use any browser to view an Office file on a wiki page or attachment view, provided that you have installed Adobe Flash Player version 9 or later. You do not need to have an Office desktop application installed on your computer, in order to view Office files in Confluence.

File Types

To be displayed in Confluence, the file needs to be a valid Microsoft Office 97-2007-compatible or PDF file, of the following types:

  • .doc and .docx
  • .xls and .xlsx
  • .ppt and .pptx
  • .pdf
Unknown macro: {hide}

If you are using OpenOffice to create and edit the documents, you will need to save your document in Microsoft Office 97-2003 format before attaching it to a Confluence page.

Above are the prerequisites for viewing or displaying Office documents in Confluence. For a full list of Office Connector prerequisites and limitations, please refer to:

Displaying a Word Document in Confluence

Usage with the Macro Browser (doc)

To insert the Office Word macro into a page using the Macro Browser,

  1. Open the Confluence page or blog post that you want to edit, then click the 'Edit' button.
  2. Click the Macro Browser icon on the toolbar. The macro browser window will open.
  3. Scroll through the list of macros to find the one you want. Alternatively, start typing the macro name into the search box at the top right of the macro browser. Macros with a matching name will appear in the main pane.
  4. Click the desired macro.
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to add the macro onto the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you have found the Office Word macro and have added the required parameter values, click 'insert' to add it to your page.

Basic Usage with the Wiki Markup Editor (doc)

{viewdoc:name=my document.doc}

Parameters (doc)

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

Parameter

Required?

Default

Description

File Name
(name)

yes

none

The file name of the Office Word document to be displayed. The document must be attached to a wiki page on your Confluence site.

Page Name
(page)

no

The page which contains the {viewdoc} macro

Enter a page name, if you wish to display a document which is attached to another Confluence page. For example:

{viewdoc:name=my document.doc|page=Sample Page}

Space Key
(space)

no

The space of the page which contains the {viewdoc} macro

Enter a space key, if you wish to display a document which is attached to a page in another Confluence space. For example:

{viewdoc:name=my document.doc|space=DOC|page=Sample Page}

Date
(date)

no

none

If the Page Name refers to a blog post instead of a conventional page, enter the date of the post in the form mm/dd/yyyy.

Editing the Word Document

When viewing a wiki page that displays an attached Office document, you can launch your Office editor directly from Confluence.

  • Move your mouse pointer to the top of the document embedded in the Confluence page, until the hidden title bar appears. (See the screenshot below.)
  • Click the title bar.
  • Confirm your action and log in as prompted.
  • The Office document will open in your Office application. Make any necessary changes, then save the document. It will be saved back into Confluence.

Screenshot: The title bar showing 'document.doc' above an embedded Office document



You will find detailed instructions in Editing an Office Document from Confluence.

Displaying a PowerPoint Presentation in Confluence

You can display an PowerPoint presentation on a Confluence page. By default, the presentation will be displayed as a dynamic slide show, using Adobe Flash Player. You can also choose to display just one of the slides as a static JPEG image.

Usage with the Macro Browser (ppt)

To insert the Office Powerpoint macro into a page using the Macro Browser,

  1. Open the Confluence page or blog post that you want to edit, then click the 'Edit' button.
  2. Click the Macro Browser icon on the toolbar. The macro browser window will open.
  3. Scroll through the list of macros to find the one you want. Alternatively, start typing the macro name into the search box at the top right of the macro browser. Macros with a matching name will appear in the main pane.
  4. Click the desired macro.
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to add the macro onto the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you have found the Office Powerpoint macro and have added the required parameter values, click 'insert' to add it to your page.

Basic Usage with the Wiki Markup Editor (ppt)

{viewppt:name=my presentation.ppt}

Parameters (ppt)

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

Parameter

Required?

Default

Description

File Name
(name)

yes

none

This file name of the PowerPoint presentation to be displayed. The document must be attached to a wiki page on your Confluence site.

Height
(height)

no

 

Specify the height of the display, in pixels (default) or as a percentage of the window's height. For example, to specify a height of 200 pixels:

{viewppt:name=my presentation.ppt|height=200}

This code also specifies a height of 200 pixels:

{viewppt:name=my presentation.ppt|height=200px}

This code specifies a height of 10 percent of the window's height:

{viewppt:name=my presentation.ppt|height=10%}

Page Name
(page)

no

The page which contains the {viewppt} macro

Enter a page name, if you wish to display a document which is attached to another Confluence page. For example:

{viewppt:name=my presentation.ppt|page=Sample Page}

Slide Number
(slide)

no

none

Specify the number of the slide which you want displayed on the Confluence page, starting with '0' for the first slide. Instead of a slide show, the page will display just the single slide represented as a JPEG image.

Space Key
(space)

no

The space of the page which contains the {viewppt} macro

Enter a space key, if you wish to display a document which is attached to a page in another Confluence space. For example:

{viewppt:name=my presentation.ppt|space=DOC|page=Sample Page}

Width
(width)

no

 

Specify the width of the display, in pixels (default) or as a percentage of the window's width. For example, to specify a width and height of 200 pixels:

{viewppt:name=my presentation.ppt|width=200|height=200}

This code also specifies a width and height of 200 pixels:

{viewppt:name=my presentation.ppt|width=200px|height=200px}

This code specifies a width of 10 percent of the window's width:

{viewppt:name=my presentation.ppt|width=10%}

Date
(date)

no

none

If the Page Name refers to a blog post instead of a conventional page, enter the date of the post in the form mm/dd/yyyy.

Viewing the Slide Show and Editing the Presentation

When you view the PowerPoint presentation on a Confluence page, options on the bottom frame of the slide show allow you to:

  • — Download the presentation and save it onto your computer.

  • — Edit the presentation in your Office application. You will find detailed instructions in Editing an Office Presentation from Confluence.

  • — Move to the first, previous, next and last slides in the presentation. Or enter a slide number to move directly to that slide.

  • — Refresh the display.

  • — Open the presentation in full-screen mode. To return to normal viewing mode, press the escape key ('Esc') on your keyboard.

Screenshot: PowerPoint presentation embedded on a Confluence page



Displaying an Excel Spreadsheet in Confluence

Usage with the Macro Browser (xls)

To insert the Office Excel macro into a page using the Macro Browser,

  1. Open the Confluence page or blog post that you want to edit, then click the 'Edit' button.
  2. Click the Macro Browser icon on the toolbar. The macro browser window will open.
  3. Scroll through the list of macros to find the one you want. Alternatively, start typing the macro name into the search box at the top right of the macro browser. Macros with a matching name will appear in the main pane.
  4. Click the desired macro.
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to add the macro onto the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you have found the Office Excel macro and have added the required parameter values, click 'insert' to add it to your page.

Basic Usage with the Wiki Markup Editor (xls)

{viewxls:name=my spreadsheet.xls}

Parameters (xls)

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

Reducing the size of the spreadsheet

Use the 'Last Column' and 'Last Row' parameters to reduce the size of the spreadsheet displayed on the wiki page. This is especially useful to prevent the display from showing empty cells. This will also help to prevent 'out of memory' errors.

Parameter

Required?

Default

Description

File Name
(name)

yes

none

This is the file name of the document to be displayed. The document must be attached to a wiki page on your Confluence site.

Last Column
(col)

no

Last column with content

Enter the number of the last column you want displayed, starting from '0' as the first column. For example, the following code will show the first 3 rows and the first 3 columns:

{viewxls:name=my spreadsheet.xls|col=2|row=2}

Show Grid?
(grid)

no

true

Select the check box in the macro browser (true in Wiki Markup) to show grid lines around each cell of the Excel spreadsheet. Clear the check box in the macro browser (false in Wiki Markup) to hide these grid lines.

Page Name
(page)

no

The page which contains the {viewxls} macro

Enter a page name, if you wish to display a document which is attached to another Confluence page. For example:

{viewxls:name=my spreadsheet.xls|page=Sample Page}

Last Row
(row)

no

Last row with content

Enter the number of the last row you want displayed, starting from '0' as the first row. For example, the following code will show the first 3 rows and the first 3 columns:

{viewxls:name=my spreadsheet.xls|col=2|row=2}

Worksheet Name
(sheet)

no

First worksheet in the spreadsheet

Enter the name of the worksheet that you want displayed.

Space Key
(space)

no

The space of the page which contains the {viewxls} macro

Enter a space key, if you wish to display a document which is attached to a page in another Confluence space. For example:

{viewxls:name=my spreadsheet.xls|space=DOC|page=Sample Page}

Date
(date)

no

none

If the Page Name refers to a blog post instead of a conventional page, enter the date of the post in the form mm/dd/yyyy.

Editing the Excel Spreadsheet

When viewing a wiki page that displays an attached Office spreadsheet, you can launch your Office editor directly from Confluence.

  • Move your mouse pointer to the top of the spreadsheet embedded in the Confluence page, until the hidden title bar appears. (See the screenshot below.)
  • Click the title bar.
  • Confirm your action and log in as prompted.
  • The spreadsheet will open in your Office application. Make any necessary changes, then save the spreadsheet. It will be saved back into Confluence.

Screenshot: The title bar showing 'spreadsheet.xls' above an embedded Excel spreadsheet



You will find detailed instructions in Editing an Office Spreadsheet from Confluence.

Displaying a PDF Document in Confluence

Usage with the Macro Browser (pdf)

To insert the View PDF macro into a page using the Macro Browser,

  1. Open the Confluence page or blog post that you want to edit, then click the 'Edit' button.
  2. Click the Macro Browser icon on the toolbar. The macro browser window will open.
  3. Scroll through the list of macros to find the one you want. Alternatively, start typing the macro name into the search box at the top right of the macro browser. Macros with a matching name will appear in the main pane.
  4. Click the desired macro.
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to add the macro onto the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you have found the View PDF macro and have added the required parameter values, click 'insert' to add it to your page.

Basic Usage with the Wiki Markup Editor (pdf)

{viewpdf:name=my document.pdf}

Parameters (pdf)

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

Parameter

Required?

Default

Description

File Name
(name)

yes

none

This is the file name of the document to be displayed. The document must be attached to a wiki page on your Confluence site.

Page Name
(page)

no

The page which contains the {viewpdf} macro

Enter a page name, if you wish to display a document which is attached to another Confluence page. For example:

{viewpdf:name=my document.pdf|page=Sample Page}

Space Key
(space)

no

The space of the page which contains the {viewpdf} macro

Enter a space key, if you wish to display a document which is attached to a page in another Confluence space. For example:

{viewpdf:name=my document.pdf|space=DOC|page=Sample Page}

Date
(date)

no

none

If the Page Name refers to a blog post instead of a conventional page, enter the date of the post in the form mm/dd/yyyy.

Viewing the PDF Document

When you view the PDF document on a Confluence page, it is displayed as a slide show. Options on the bottom frame of the slide show allow you to:

  • — Download the PDF file and save it onto your computer.

  • — Move to the first, previous, next and last pages in the document. Or enter a page number to move directly to that page.

  • — Refresh the display.

  • — Open the document in full-screen mode. To return to normal viewing mode, press the escape key ('Esc') on your keyboard.

Screenshot: PDF document embedded on a Confluence page



Troubleshooting

Problems? Please refer to our guide to the Office Connector limitations and known issues.

RELATED TOPICS

Take me back to the Wikis Help Guide.