Wiki source code of Exports

Last modified by Vincent Massol on 2024/01/05

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 = Usage =
6
7 As a user, you can export a single wiki page or a set of wiki pages into several formats. To perform a page export click on "Export" in the "More actions" menu.
8
9 {{image reference="ExportFlamingo.png" /}}
10
11 This opens the Export Modal from where you can select the export format.
12
13 {{image reference="exportDialog.png" /}}
14
15 The next step depends on whether the selected format supports multi-page export or not and whether the current page is [[a nested page or a terminal page>>xwiki:Documentation.UserGuide.Features.ContentOrganization.WebHome]]:
16
17 * if multi-page export is supported, like in the case of XAR export, and the current page is a nested page then the Export Tree Modal is shown(((
18 {{image reference="exportTreeModal.png" /}}
19 )))
20 * otherwise the user is taken directly to the dedicated page for the selected export format
21
22 In addition, Admins can also export all the pages of the wiki through the [[Import/Export Admin feature>>Documentation.AdminGuide.ImportExport]].
23
24 = Export Types =
25
26 == ODT Export ==
27
28 If you configure your wiki to work with an office server ([[LibreOffice>>http://www.libreoffice.org/]] or [[OpenOffice>>http://www.openoffice.org/]]) as described in the [[Office Importer Application>>extensions:Extension.Office Importer Application]] you'll notice a new entry in the Export Modal (as long as you are connected to the office server). Only single-page ODT export is supported at the moment.
29
30 {{info}}
31 You can tweak the export URL to export to other office formats supported by your office server. For instance ##/xwiki/bin/export/Sandbox/WebHome?format=doc## exports ##Sandbox.WebHome## page to Microsoft Word's proprietary DOC format.
32 {{/info}}
33
34 == PDF Export ==
35
36 {{version since="14.10"}}
37 Support for PDF export is provided by the [[PDF Export Application>>extensions:Extension.PDF Export Application.WebHome]] which is bundled by default in XWiki Standard. Checkout its documentation for more information.
38 {{/version}}
39
40 {{version before="14.10"}}
41 On older versions of XWiki the PDF export was implemented using Apache FOP (Formatting Objects Processor). This implementation is replaced, by default, by the browser-based (client-side) PDF export provided by the PDF Export Application. You can restore the old implementation, if you want, from the PDF Export Application configuration.
42
43 The old PDF Export has a UI interface to manage the export:
44
45 {{image reference="pdfExportOptions.png"/}}
46
47 === Advanced ===
48
49 A PDF export can also be triggered by using the following type of URLs:
50
51 {{code language="none"}}
52 http://server/xwiki/bin/export/Space/Page?format=pdf
53 {{/code}}
54
55 The old PDF export (unlike the new one) doesn't provide an UI for multipage export. However it's possible to export a set of pages, using the following type of URL:
56
57 {{code language="none"}}
58 http://server/xwiki/bin/export/Space/Page?format=pdf&pages=Admin.Page_A&pages=Admin.Page_B&pages=Admin.Page_C...
59 {{/code}}
60
61 In addition the following URL parameters can be added to refine what should be exported:
62
63 * ##pages##: there can be several such parameters, each representing a page to export. For example: ##&pages=Main.WebHome&pages=Blog.WebHome##.
64 {{info}}When ##pages## parameters are specified, the current document specified in the URL isn't used{{/info}}
65 * ##includechilds##: the value is a number specifying the depth of children pages to include in the PDF export. For example ##&includechilds=2## will include all children pages of the page to export, all its children (i.e. pages which have the page as its parent) and all the children's children.
66 * ##includelinks##: the value is a number specifying the depth of linked pages to include in the PDF export. For example ##&includelinks=2## will include all pages linked from the page to export and the links in the linked pages.
67 * ##pagebreaks##: if the value is set to ##1## then a page break is inserted between all exported pages.
68 * ##comments##: if set to ##1## then also export the comments.
69 * ##attachments##: if set to ##1## then also export the attachments (only if they are images).
70
71 {{info}}
72 Notes:
73
74 * It's also possible to [[customize how the generated PDF looks like>>Documentation.AdminGuide.Configuration#HCustomizingthePDFexportLook26Feel]].
75 {{/info}}
76 {{/version}}
77
78 == RTF Export ==
79
80 The RTF export works in the same manner as the ODT export, so it also requires an office server to be configured and connected. Similarly, only single-page RTF export is supported at the moment.
81
82 == XAR Export ==
83
84 The XAR export allows exporting pages in the internal XML format used by XWiki. This is the format that you can use to [[Import/Export>>Documentation.AdminGuide.ImportExport]] pages and applications into/from XWiki instances.
85
86 Multipage XAR export is supported, so if the current page is nested then the Export Tree Modal is shown upon selecting the XAR format. From there you can chose the child pages that you want to export along with the current page. You can filter the tree to exclude extension pages (e.g. //Created pages//, //Created and modified pages// or //All pages//). Check out the [[Administration Application>>extensions:Extension.Administration Application#HExport]] for more information about the export tree.
87
88 {{info}}
89 Naturally, this tree is not displayed if the current page is terminal, which means it cannot have children.
90 {{/info}}
91
92 Notes:
93
94 * The "XAR" export format option will only appear if you are logged in with an admin user.
95 * To import back a XAR file, you also need to be an admin user and use the [[Import section in Administration>>Documentation.AdminGuide.ImportExport]]
96
97 === Advanced ===
98
99 You could also use the following type of URL (note that the ##Space/Page## part in the URL is ignored and the Export action only takes into account the ##pages## Query String parameter):
100
101 {{code language="none"}}
102 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Space.Page
103 {{/code}}
104
105 In addition the following URL parameters can be added to refine what should be exported:
106
107 * ##pages##: there can be several such parameters, each representing a pattern of pages to export. Here is the format of an export pattern:(((
108 {{code language="none"}}
109 wikiid:pageFullNamePattern
110 {{/code}}
111
112 * ##wikiid##: the name of the wiki from where to get the wiki pages
113 * ##pageFullNamePattern##: the full name pattern of the page based on [[SQL "LIKE" comparator>>http://www.techonthenet.com/sql/like.php]]. Remember that the character {{{%}}} has to be converted in {{{%25}}} in an URL.
114 )))
115 * ##excludes##: there can also be several such parameter, each representing a pattern, or list of pages associated to a ##pages## pattern. The format is the same as for pages except all special characters must be encoding in the URL. Also, as the parameter is attached to a ##pages## parameter, be careful with the order. See the examples below.
116 * ##name##: the name of the exported XAR file. If not specified, a default name will be used.
117 * ##history##: if defined then also export the page's history. Example: ##&history=true##
118 * ##backup##: if defined then the XWiki document author of each page remains the same as the one exported when reimporting into an XWiki instance.
119 * ##author##: if defined, specifies the author's name in the XAR export which can later be viewed when reimporting into an XWiki instance.
120 * ##description##: if defined, gives a description added to the XAR export which can later be viewed when reimporting into an XWiki instance.
121 * ##license##: if defined, specifies the license to the XAR export which can later be viewed when reimporting into an XWiki instance.
122 * ##version##: if defined, specifies the version of the export to the XAR.
123
124 Some examples:
125
126 * Exports all pages in the ##Main## space:(((
127 {{code language="none"}}
128 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25
129 {{/code}}
130 )))
131 * Exports all pages in the current wiki:(((
132 {{code language="none"}}
133 http://server/xwiki/bin/export/Space/Page?format=xar&pages=%25.%25
134 {{/code}}
135 )))
136 * Exports the pages ##Main.WebHome## and ##Blog.WebHome##:(((
137 {{code language="none"}}
138 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.WebHome&pages=Blog.WebHome
139 {{/code}}
140 )))
141 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
142 {{code language="none"}}
143 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
144 {{/code}}
145 )))
146 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
147 {{code language="none"}}
148 http://server/xwiki/bin/export/Space/Page?format=xar&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
149 {{/code}}
150 )))
151 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
152 {{code language="none"}}
153 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
154 {{/code}}
155 )))
156
157 == HTML Export ==
158
159 The HTML export allows exporting wiki pages as static HTML pages independent from the XWiki engine. All pages are exported in view mode. That way you can export a whole space containing documentation and access it on your computer without any web server. The export is done with the current skin.
160
161 Multipage HTML export is supported, so if the current page is nested then the Export Tree Modal is shown upon selecting the HTML format. From there you can chose the child pages that you want to export along with the current page. You can filter the tree to exclude extension pages (e.g. //Created pages//, //Created and modified pages// or //All pages//). Check out the [[Administration Application>>extensions:Extension.Administration Application#HExport]] for more information about the export tree.
162
163 The HTML export is packaged as a ZIP. Here's an example of its content and how it's organized:
164
165 {{image reference="htmlexport-content.png"/}}
166
167 A basic index page is also generated and provides a list (and links) of all pages that have been exported. For example:
168
169 {{image reference="htmlexport-index.png"/}}
170
171 === Advanced ===
172
173 You could also use the following type of URL:
174
175 {{code language="none"}}
176 http://server/xwiki/bin/export/Space/Page?format=html
177 {{/code}}
178
179 In addition the following URL parameters can be added to refine what should be exported:
180
181 * ##name##: the name of the generated Zip file.
182 * ##description##: the comment in the generated Zip file.
183 * ##pages##: there can be several such parameters, each representing a pattern of pages to export. Here is the format of an export pattern:(((
184 {{code language="none"}}
185 wikiid):pageFullNamePattern
186 {{/code}}
187
188 * ##wikiid##: the name of the wiki from where to get the wiki pages
189 * ##pageFullNamePattern##: the full name pattern of the page based on [[SQL "LIKE" comparator>>http://www.techonthenet.com/sql/like.php]]. Remember that the character {{{%}}} has to be converted in {{{%25}}} in an URL. More precisely, a page format is {{code language="none"}}(space id1).(space id2).(space idN).(page id){{/code}}.
190 )))
191 * ##excludes##: there can also be several such parameter, one after each ##pages##parameter, each representing a pattern, or list of pages associated to the ##pages## pattern. The format is the same as for pages except all special characters must be encoded in the URL.
192
193 Some examples:
194
195 * Exports the current page from the current wiki:(((
196 {{code language="none"}}
197 http://server/xwiki/bin/export/Space/Page?format=html
198 {{/code}}
199 )))
200 * Exports the current page from the current wiki in ##packagename.zip##:(((
201 {{code language="none"}}
202 http://server/xwiki/bin/export/Space/Page?format=html&name=packagename
203 {{/code}}
204 )))
205 * Exports all the pages from the ##Space## space as well as the ##Space2.Page## page from the current wiki:(((
206 {{code language="none"}}
207 http://server/xwiki/bin/export/Space/Page?format=html&pages=Space.%25&pages=Space2.Page
208 {{/code}}
209 )))
210 * Exports all the pages from the ##Space## space located in the ##wiki2## subwiki:(((
211 {{code language="none"}}
212 http://server/xwiki/bin/export/Space/Page?format=html&pages=wiki2:Space.%25
213 {{/code}}
214 )))
215 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
216 {{code language="none"}}
217 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
218 {{/code}}
219 )))
220 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
221 {{code language="none"}}
222 http://server/xwiki/bin/export/Space/Page?format=html&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
223 {{/code}}
224 )))
225 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
226 {{code language="none"}}
227 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
228 {{/code}}
229 )))
230 * Exports all pages from the current wiki:(((
231 {{code language="none"}}
232 http://server/xwiki/bin/export/Space/Page?format=html&pages=%25.%25
233 {{/code}}
234 )))
235 * Exports all pages from the "somewiki" wiki:(((
236 {{code language="none"}}
237 http://server/xwiki/bin/export/Space/Page?format=html&pages=somewiki:%25.%25
238 {{/code}}
239 )))

Get Connected