TheGroundZero / openvasreporting

OpenVAS Reporting: Convert OpenVAS XML report files to reports
Other
131 stars 45 forks source link

How to edit the docx template #11

Closed juanluisbaptiste closed 4 years ago

juanluisbaptiste commented 4 years ago

Hi,

First of all, many thanks for this project, it comes sooo handy and time saving !!

One question though, how can I edit the included template ? when I open it on libreoffice on linux or in google drive I get a blank empty file.

TheGroundZero commented 4 years ago

Hi

There currently is no possibility to create templates in the tool.
All content is generated programmatically.
Feel free to make modifications in your local copy to fit your needs.

This is due to the nature of the docx format and the libraries I'm using.

If you know of any (Python3) libraries that do offer templating solutions in docx/xlsx format, please let me know.

TheGroundZero commented 4 years ago

Hi @juanluisbaptiste

First of all: my apologies. I may have misunderstood your question.

The docx export functionality does indeed allow you to configure a template.
This template document is used for the formatting of the fonts of the text, headers, etc.

The template file indeed "looks" to be empty, as it doesn't contain any content.
However, there are certain styles configured in this file.

See the full documentation for more info: http://openvas-reporting.sequr.be/en/latest/usage/export-word.html#create-word-report-using-a-different-template

juanluisbaptiste commented 4 years ago

Indeed I was confused by your answer as I already had seen that documentation link, but it was not clear from reading it how to edit the template file. I really don't understand what you mean with this:

The custom template document must contain a definition for the following styles:

Title (default)
Heading 1 (default)
Heading 4 (default)
OV-H1toc (custom format for Heading 1, included in Table of Contents)
OV-H2toc (custom format for Heading 2, included in Table of Contents)
OV-Finding (custom format for finding titles, included in Table of Contents)

Define how ? where do I do that ?

TheGroundZero commented 4 years ago

In Word, you'll find these styles in the style selector. image You can modify these by right-clicking the style and clicking Modify.

In LibreOffice you can find and modify these styles as follows:

  1. Open the style dropdown on the top-lef image
  2. Click "More Styles ..."
  3. In the Style selector sidebar, open the dropdown at the bottom image
  4. Select "All Styles" image
  5. You can now right-click any of these styles to modify them.

Don't forget to save the modified document after making any changes.
Also make sure you have an original copy somewhere. You can always download it from the repo as well.

juanluisbaptiste commented 4 years ago

Many thanks for this explanation, very clear.