Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Div
idProductTOC

On this page

Table of Contents
maxLevel1
excludeOn this page
typeflat
separatorpipe

Overview

Excerpt

The Attachment Table macro produces a table of attachments based on various selection criteria, including powerful space and page selection.

Further customization is possible by specifying filters to select attachments by name, comment content, and labels. You can select and indicate the order in which columns are to be displayed based on their column name or number.  Refer to Columns Available to Display for details.

The resulting table can be customized and supports most common table capabilities.

Tip

Depending on the selection criteria used and number of attachments, pages, and spaces that need to be processed, this could be a long running process. Choose your selection criteria carefully and consider using the Cache Macro to limit the number of times the attachment list generation needs to be done and/or the Future Macro to defer processing. The limit parameter described below can also be used to limit processing.

Info
titleSee a live site creatively using the attachment-table macro

From vxvista.org: Recorded Webinars

Image Modified

Basic Use

This macro can be deployed using one of the following methods:

Selected from the Macro BrowserAttachment Table
Markup Shortcut{attachment-table}

Screenshot

Image Modified

Parameters

(info) Click a column heading to toggle the sorting of that column.

Refer to Using Regex Expressions To Select Attachments to learn how to form the regular expressions that are supported by several parameters below.

Table plus
highlightColor#ffffec
rowStylesbackground:#f0f0f0;color:#222;font-size:14px;border-bottom:black 2px solid;border-top:black 2px solid;,
stylebackground-color:white;
autoNumbertrue
Parameter
Default
Macro Browser Label
Description
pagecurrent pagePage to list attachments from

Simple way to find a single page and display it's attachments. Use a page title (in the current space) or preface the title with *SPACEKEY:* if the page is in a different space. This parameter takes precedence over the other page selection parameters. Leave blank to use spaceRegex and pageRegex instead.

spaceRegex Space key or space name regex

A regular expression (regex) pattern to match on space keys or space names. Used in combination with the pageRegex parameter to select pages from which attachments will be chosen. @self can be used to identify the current space. If spaceRegex is left blank, the page parameter is required.

includePersonalSpacesfalseInclude personal spacesUse to determine whether personal spaces matching the spaceRegex should be included or not.
pageRegex Page name regexA regular expression (regex) pattern to match on page names (titles). Used in combination with the spaceRegex parameter to select pages from which attachments will be chosen.
pageLabelRegex Page label regexA regular expression (regex) pattern to match on page labels. Used in combination with the pageRegex and spaceRegex parameters to select pages from which attachments will be chosen. Pages must match all selection criteria.
attachmentRegex Attachment name regexA regular expression (regex) pattern to match on attachment names. Used in combination with the commentRegex and labelRegex parameters to select attachments. Attachment must match all selection criteria.
commentRegex Attachment comment regexA regular expression (regex) pattern to match on attachment comments. Used in combination with the attachmentRegex and labelRegex parameters to select attachments. Attachment must match all selection criteria.
labelRegex Attachment label regexA regular expression (regex) pattern to match on attachment labels. Used in combination with the attachmentRegex and commentRegex parameters to select attachments. Attachment must match all selection criteria. Matching technique is determined by the labelMatchOption parameter.
labelMatchOptionsingleLabel match option

Indicates the manner in which to apply the labelRegex parameter (for attachments) and the pageLabelRegex parameter (for pages) when looking for matching labels.

Table plus
autoNumbertrue
OptionSelection
singleAn attachment that has at least one label that matches the pageLabelRegex or  labelRegex pattern will be considered selected.
allThe pageLabelRegex and labelRegex are used to match a blank separated list of all labels.

columnsdefault columnsColumns to show

Comma separated list of column names or numbers in any order. When blank, a default set of columns is shown. Columns are enumerated starting at 1.

See Columns Available for Display below for a list of columns.

textForNone Text to display when no attachments matchIndicates the text that should be displayed when no attachments are found that match the search criteria.
dateFormatConfluence default

Date format

Date format for created and modified columns. Use a simple date format string.
limit1000

Limit number of attachments to retrieve

Processing stops after the number of attachments found matching the selection criterial reaches the limit value. Space, page, and attachment processing is ordered by name.

Common Parameters

Include Page
info:_CommonTableCapabilitiesParametersTBL
info:_CommonTableCapabilitiesParametersTBL

 

Anchor
ColumnsAvailableForDisplay
ColumnsAvailableForDisplay

Anchor
ColumnsToShow
ColumnsToShow
Columns Available for Display

The Attachment Table macro allows the user to select the columns to be displayed as well as the order. A default set of columns is displayed unless an explicit list is provided. You can select and indicate the order in which columns are to be displayed based on their column name or number. Use the columns parameter to specify a comma separated list of column names or numbers.

(info) Please note that column names are case insensitive.

In most cases the column heading can be used in place of the column name, but there are a few cases where that is ambiguous. In this case, the first column matching the heading will be used. 

Default columns for single page attachmentsfile, size, creator, created, comment
Default columns for multiple page attachmentspage, file, size, creator, created, comment
Csv
outputwiki
highlightColor#ffffec
rowStylesbackground:#f0f0f0;color:#222;font-size:14px;border-bottom:black 2px solid;border-top:black 2px solid;,
sortColumn1
stylebackground-color:white;
Column\\ Number, Column\\ Name, Column\\ Heading, Description
1, page, Page, Link to page the attachment is on
2, file, File, File link to download or view
3, size, Size, Size of attachment in bytes
4, creator, Creator, User link to who added the attachment
5, created, Created, When the attachment was added
6, comment, Comment, Descriptive comment about the attachment	
7, labels, Labels, Attachment labels
8, version, Version, Version number
9, type, Type, Type of attachment - simple name
10, mimetype, Mime Type, Technical mime type name
11, size2, Size, Size of attachment in KB or MB
12, modifier, Modifier, User link to who modified attachment properties
13, modified, Modified, When attachment properties were modified
14, id, Id, Confluence content id
15, space, Space, Key of the space containing the attachment	
16, spacename, Space, Name of the space containing the attachment
17, pagetitle, Page, Title of the page containing the attachment
18, filename, File, File name of the attachment (not a link)
19, thumbnail, Thumbnail, Thumbnail image when the attachment is an image
20, image, Image, Image when the attachment is an image
21, location, Location, Link to the location on the page attachments list for the attachment
22, properties, Properties, Link to the attachment properties display for the attachment

Examples

Filter by label (Content by label)
showLabelsfalse
spaces@self
showSpacefalse
sorttitle
operatorAND
cqllabel = "attachment_table" and label = "example" and space = currentSpace()
labelsexample,attachment_table

Other Macros

Below is a list of all other Macros available within this Add-on:

Filter by label (Content by label)
showLabelsfalse
spaces@self
sorttitle
typepage
cqllabel = "macro_home" and type = "page" and space = currentSpace()
labelsmacro_home

Additional References

Include Page
_SupportFooter
_SupportFooter

...