-
Notifications
You must be signed in to change notification settings - Fork 181
Description
First off, I want to say that the existing MS Project XML and HTML exports are excellent and robust. However, in many corporate and industrial environments, they simply aren't enough.
The reality is that the business world runs on Microsoft Excel. While CSV support exists, it is insufficient for client-facing deliverables; it strips away the visual hierarchy, the Gantt chart visualization, and the formatting that makes the data readable. Similarly, PDFs remain the gold standard for immutable digital documentation, and SVGs are critical for embedding high-quality vector graphics into other reports.
This is not a new request. The community has been asking for these capabilities for over a decade:
- Export to SVG #98 (Export to SVG) - Opened in 2013 (12 years ago!)
- Report in PDF format #230 (Report in PDF format)
- tjp to pdf conversion #287 (tjp to pdf conversion)
Despite this long-standing demand, we are still relying on workarounds or external converters. I believe it is time to discuss what it would actually take to implement native support for these formats directly within the TaskJuggler Ruby codebase, rather than relying on external scripts.
The Proposal
We should aim to implement native exporters (:xlsx, :pdf, :svg) in TaskJuggler::Report.
Technical Challenges & Bottlenecks
I've been looking at the codebase structure to understand the feasibility. Here is a breakdown of the requirements and likely bottlenecks for each format:
1. Native Excel (.xlsx)
The Challenge:
CSV is easy because it's just text. Excel is a binary format (zipped XML). The main difficulty here is Visual Fidelity. We don't just want data; we want the Gantt chart bars, the indentation of the WBS, and the color coding.
- Dependencies: We would likely need to introduce a Ruby gem like
caxlsx(formerly axlsx) orrubyXLto handle the generation of the.xlsxfile structure. - Rendering: The current
GanttChart.rblogic relies heavily on HTMLdivs and CSS for positioning bars. This logic would need to be essentially rewritten to map time-scales to Excel columns and use Excel Shapes or conditional formatting to draw the bars. - Bottleneck: Mapping the pixel-perfect layout logic from
Painter.rbinto Excel's grid-based system.
2. PDF Export
The Challenge:
Pagination. The current HTML reports are continuous scrolling views. A PDF requires strict page breaking logic (both vertical for task lists and horizontal for long timelines).
- Dependencies: We could use a library like
Prawn(pure Ruby) orGrover(Puppeteer wrapper).Prawnkeeps dependencies light but requires manually "drawing" every line of text and table, essentially duplicating the HTML layout engine work. Using a wrapper likeGroverrequires the user to have Node/Chromium installed, which increases the footprint significantly. - Bottleneck: Handling the "Gantt Header" scale across multiple pages is notoriously difficult in PDF generation without breaking the layout.
3. SVG Export
The Challenge:
This should theoretically be the easiest because TaskJuggler already has a Painter class that seems to support SVG primitives.
- Bottleneck: It seems the SVG support is currently tightly coupled with the HTML report generation (embedded SVG). We would need to decouple the
GanttChartrender logic so it can output a standalone.svgfile without the surrounding HTML container.
Discussion
Is there any appetite among the maintainers to introduce gems like caxlsx or Prawn into the core dependencies? If we want TaskJuggler to remain a viable alternative to MS Project in 2024 and beyond, native support for these "Gold Standard" formats is essential.
I'm interested to hear thoughts on the architecture for a "pluggable" export system that doesn't just rely on the intermediate HTML format.