Wiki source code of Exports

Version 113.1 by Marius Dumitru Florea on 2022/11/28

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 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.
6
7 {{image reference="ExportFlamingo.png" /}}
8
9 This opens the Export Modal from where you can select the export format.
10
11 {{image reference="exportDialog.png" /}}
12
13 The next step depends on whether the selected format supports multi-page export or not:
14
15 * if multi-page export is supported, like in the case of XAR export, then the Export Tree Modal is shown(((
16 {{image reference="exportTreeModal.png" /}}
17 )))
18 * otherwise the user is taken directly to the dedicated page for the selected export format
19
20 In addition, Admins can also export all the pages of the wiki through the [[Import/Export Admin feature>>platform:AdminGuide.ImportExport]].
21
22 = PDF Export =
23
24 {{info}}
25 {{version since="14.2"}}
26 An experimental [[client-side PDF export extension>>extensions:Extension.PDF Export Application.WebHome]] is available and is meant to replace the current server-side one.
27 {{/version}}
28 {{/info}}
29
30 {{image reference="exportAsPDF.png"/}}
31
32 The PDF Export has a UI interface to manage the export:
33
34 {{image reference="pdfExportOptions.png"/}}
35
36 To export a page as PDF, use the action menu as explained above or use the following type of URL:
37
38 {{code language="none"}}
39 http://server/xwiki/bin/export/Space/Page?format=pdf
40 {{/code}}
41
42 Right now we don't have any user interface for exporting an arbitrary set of wiki pages. This is a [[work in progress>>https://jira.xwiki.org/browse/XWIKI-1289]]. However it's possible to export a set of pages, using the following type of URL:
43
44 {{code language="none"}}
45 http://server/xwiki/bin/export/Space/Page?format=pdf&pages=Admin.Page_A&pages=Admin.Page_B&pages=Admin.Page_C...
46 {{/code}}
47
48 In addition the following URL parameters can be added to refine what should be exported:
49
50 * ##pages##: there can be several such parameters, each representing a page to export. For example: ##&pages=Main.WebHome&pages=Blog.WebHome##.
51 {{info}}When ##pages## parameters are specified, the current document specified in the URL isn't used{{/info}}
52 * ##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.
53 * ##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.
54 * ##pagebreaks##: if the value is set to ##1## then a page break is inserted between all exported pages.
55 * ##comments##: if set to ##1## then also export the comments.
56 * ##attachments##: if set to ##1## then also export the attachments (only if they are images).
57
58 {{info}}
59 Notes:
60
61 * It's also possible to [[customize how the generated PDF looks like>>platform:AdminGuide.Configuration#HCustomizingthePDFexportLook26Feel]].
62 * There's also a contributed panel that provides [[an UI for PDF Export options.>>extensions:Extension.PDF Export Panel Application]]
63 {{/info}}
64
65 = ODT Export =
66
67 {{image reference="exportAsODT.png"/}}
68
69 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 popup (as long as you are connected to the office server).
70
71 {{info}}
72 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.
73 {{/info}}
74
75 = RTF Export =
76
77 The RTF export works in the same manner as the PDF export.
78
79 {{image reference="exportAsRTF.png"/}}
80
81 Similar to the ODT export, you need an office server started to see the RTF export option.
82
83 = XAR Export =
84
85 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>>platform:AdminGuide.ImportExport]] pages and applications into/from XWiki instances.
86
87 To export a page as a XAR use the action menu as explained above:
88
89 {{image reference="exportAsXAR.png"/}}
90
91 A tree will be displayed to allow you to chose children 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.
92
93 {{info}}
94 Naturally, this tree is not displayed if the current page is terminal, which means it cannot have children.
95 {{/info}}
96
97 Notes:
98
99 * The "Export XAR" option will only appear if you are logged in with an admin user.
100 * To import back a XAR file, you also need to be an admin user and use the [[Import section in Administration>>Documentation.AdminGuide.ImportExport]]
101
102 == Advanced ==
103
104 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):
105
106 {{code language="none"}}
107 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Space.Page
108 {{/code}}
109
110 In addition the following URL parameters can be added to refine what should be exported:
111
112 * ##pages##: there can be several such parameters, each representing a pattern of pages to export. Here is the format of an export pattern:(((
113 {{code language="none"}}
114 wikiid:pageFullNamePattern
115 {{/code}}
116
117 * ##wikiid##: the name of the wiki from where to get the wiki pages
118 * ##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.
119 )))
120 * ##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.
121 * ##name##: the name of the exported XAR file. If not specified, a default name will be used.
122 * ##history##: if defined then also export the page's history. Example: ##&history=true##
123 * ##backup##: if defined then the XWiki document author of each page remains the same as the one exported when reimporting into an XWiki instance.
124 * ##author##: if defined, specifies the author's name in the XAR export which can later be viewed when reimporting into an XWiki instance.
125 * ##description##: if defined, gives a description added to the XAR export which can later be viewed when reimporting into an XWiki instance.
126 * ##license##: if defined, specifies the license to the XAR export which can later be viewed when reimporting into an XWiki instance.
127 * ##version##: if defined, specifies the version of the export to the XAR.
128
129 Some examples:
130
131 * Exports all pages in the ##Main## space:(((
132 {{code language="none"}}
133 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25
134 {{/code}}
135 )))
136 * Exports all pages in the current wiki:(((
137 {{code language="none"}}
138 http://server/xwiki/bin/export/Space/Page?format=xar&pages=%25.%25
139 {{/code}}
140 )))
141 * Exports the pages ##Main.WebHome## and ##Blog.WebHome##:(((
142 {{code language="none"}}
143 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.WebHome&pages=Blog.WebHome
144 {{/code}}
145 )))
146 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
147 {{code language="none"}}
148 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
149 {{/code}}
150 )))
151 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
152 {{code language="none"}}
153 http://server/xwiki/bin/export/Space/Page?format=xar&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
154 {{/code}}
155 )))
156 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
157 {{code language="none"}}
158 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
159 {{/code}}
160 )))
161
162 = HTML Export =
163
164 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.
165
166 To export a page as HTML use the action menu as explained above:
167
168 {{image reference="exportAsHTML.png"/}}
169
170 A tree will be displayed to allow you to chose children pages that you want to export along with the current page.
171
172 The HTML export is packaged as a ZIP. Here's an example of its content and how it's organized:
173
174 {{image reference="htmlexport-content.png"/}}
175
176 A basic index page is also generated and provides a list (and links) of all pages that have been exported. For example:
177
178 {{image reference="htmlexport-index.png"/}}
179
180 == Advanced ==
181
182 You could also use the following type of URL:
183
184 {{code language="none"}}
185 http://server/xwiki/bin/export/Space/Page?format=html
186 {{/code}}
187
188 In addition the following URL parameters can be added to refine what should be exported:
189
190 * ##name##: the name of the generated Zip file.
191 * ##description##: the comment in the generated Zip file.
192 * ##pages##: there can be several such parameters, each representing a pattern of pages to export. Here is the format of an export pattern:(((
193 {{code language="none"}}
194 wikiid:pageFullNamePattern
195 {{/code}}
196
197 * ##wikiid##: the name of the wiki from where to get the wiki pages
198 * ##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.
199 )))
200 * ##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.
201
202 Some examples:
203
204 * Exports the current page from the current wiki:(((
205 {{code language="none"}}
206 http://server/xwiki/bin/export/Space/Page?format=html
207 {{/code}}
208 )))
209 * Exports the current page from the current wiki in ##packagename.zip##:(((
210 {{code language="none"}}
211 http://server/xwiki/bin/export/Space/Page?format=html&name=packagename
212 {{/code}}
213 )))
214 * Exports all the pages from the ##Space## space as well as the ##Space2.Page## page from the current wiki:(((
215 {{code language="none"}}
216 http://server/xwiki/bin/export/Space/Page?format=html&pages=Space.%25&pages=Space2.Page
217 {{/code}}
218 )))
219 * Exports all the pages from the ##Space## space located in the ##wiki2## subwiki:(((
220 {{code language="none"}}
221 http://server/xwiki/bin/export/Space/Page?format=html&pages=wiki2:Space.%25
222 {{/code}}
223 )))
224 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
225 {{code language="none"}}
226 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
227 {{/code}}
228 )))
229 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
230 {{code language="none"}}
231 http://server/xwiki/bin/export/Space/Page?format=html&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
232 {{/code}}
233 )))
234 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
235 {{code language="none"}}
236 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
237 {{/code}}
238 )))

Get Connected