How to customize MS Word exports

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

アトラシアン社外秘

この記事は未検証なのでお客様と共有できません。

このページの内容は、Confluence でのカスタマイズや開発の変更に関連しています。したがって、アトラシアン サポートは、このページに記載されている手順に対するサポートの提供を保証できませんこの資料は情報提供のみを目的としているため、お客様自身の責任でご使用ください。

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

目的

Confluence exports a Confluence page as a Microsoft Word document by:

  1. Generating the HTML rendering of a page from Confluence wiki markup
  2. Overriding some Confluence page styles with MS Word styles using a CSS wrapper

The wrapper is generated using a Velocity macro to provide CSS style information specific to MS Word exports.

ソリューション

Modifying Content

Please do not attempt to modify the output without some experience in CSS and HTML markup. You may also need to review Velocity template language.

Before modifying any styles, you should always take a backup of both any files you are modifying and your entire Confluence install directory. If you require assistance with your customisation attempt, you should post your modified files along with a technical description to Atlassian Answers.

重要なファイル

The formatting is defined using the CSS styles in main Confluence stylesheet and overridden by any styles in the Word export wrapper.

Main Stylesheet

This file formats the default appearance of all Confluence content. Changes to this document will be shown when viewing a page from within Confluence, as well as in HTML or MS Word exports. You should avoid changing this document unless you wish a style to be changed throughout Confluence. The file is located under the Confluence install directory:

...\confluence\WEB-INF\classes\styles\site-css.vm

Export Wrapper

This file overrides the main Confluence stylesheet, so styles outlined in this file will be specific to MS Word exports. It set the font and style for body text, some macro and grids, and a default background colour. The file is located under the Confluence install directory:

...\confluence\pages\exportword.vm

How To Modify Styles

If the CSS tag already exists in the Word export wrapper, you can modify it directly. If the CSS tag is defined by the main stylesheet, copy it into the export wrapper as a new entry in the <style> element and update it there:

  1. Identify its CSS tag in the main stylesheet. You may need to use trial and error to identify which cascading property is relevant
  2. Transfer the tag into the Word export wrapper so that it overrides the main stylesheet
  3. Modify the tag style in the wrapper

Common Modifications

You can easily set the body font or background colour in the export wrapper.

Modify Body Font

The wrapper sets the body font:

body, p, td, table, tr, .bodytext, .stepfield {
    font-family: Verdana, arial, sans-serif;
}

Modify Background Colour

The wrapper sets the background colour:

<body style="background-color: white; padding: 10px;">
    <h1>$page.title</h1>
    $renderedPageContent
</body>
最終更新日 2022 年 11 月 28 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.