Feature #8959
openMicrosoft Office Document in Browser Preview
Description
It would be very usefull to have a office document preview, so being able to read word documents in document, files or attachment area.
This coiukld be done by using on the fly conversion which can be done by openoffice server. There is a simple an easy web service called Jodconverter for converting office to many other formats like pdf or html.
Files
Updated by Go MAEDA about 21 hours ago
- File clipboard-202602270715-xhmcc.png clipboard-202602270715-xhmcc.png added
- File clipboard-202602270717-tcvli.png clipboard-202602270717-tcvli.png added
- File 0001-Add-Microsoft-Office-documents-preview-via-MarkItDow.patch 0001-Add-Microsoft-Office-documents-preview-via-MarkItDow.patch added
- Subject changed from Office Document in Browser Preview to Microsoft Office Document in Browser Preview
- Category changed from Documents to Attachments
- Target version set to Candidate for next major release
I wrote a patch to add a simple preview for Microsoft Office documents (such as Word, Excel, and PowerPoint) on AttachmentsController#show page. The patch uses Microsoft's MarkItDown command to convert supported Office files into Markdown and renders that Markdown in Redmine. Because the preview is generated from Markdown, original layout is not preserved and non-text contents will be lost, but it enables quick content inspection without downloading the file.
This MS Office documents preview is available only when MarkItDown is installed. It is an optional dependency, so Redmine continues to work without it; only this preview feature is unavailable. To install MarkItDown, run: pip install 'markitdown[all]'.
When a user opens `AttachmentsController#show` page for a supported MS Office attachment, Redmine calls the `markitdown` command and converts the file to Markdown, which may take a few seconds. Redmine then renders the converted Markdown as the preview. Generated Markdown is cached in tmp/markdownized_previews, so subsequent accesses are much faster. Preview content is truncated to a fixed size limit of 100 KB. This caching approach follows the same pattern already used by thumbnails, which are generated via ImageMagick convert and stored in tmp/thumbnails.
Currently, for Microsoft Office attachments, Redmine does not show document content on the attachment page; users must download the file and open it locally to inspect it. This patch adds a practical inline preview that helps users quickly understand what the document contains and can reduce download/open steps in daily workflows.
Preview for a MS Word document:
Original MS Word document: