Skip to content

Design Document: Export to Excel

Dmitry Barashev edited this page Apr 3, 2017 · 1 revision

Summary

We'd like to be able to export GanttProject data to Excel files in addition to already existing CSV export. This document describes user interface and technical aspects of the implementation.

In short, the task comes down to relatively small refactoring of the core CSV exporting code and enhancing its UI part with file type chooser.

User interface

Currently user can choose CSV export option in the list of all export options. We'd like CSV and Excel exports to be a single option called "Export to Spreadsheet" with the ability to choose file type. This is similar to Export to image which is a single option with a dropdown for choosing PNG or JPEG file type.

We also want to keep a single page "Spreadsheet" in the settings dialog, with a separate section specific to CSV export and task/resource field lists shared between CSV and Excel exports.

Program interface

CSV export uses Apache Commons CSV library and in particular its CSVPrinter class. There is a lot of non-trivial code in the export which we want to keep and don't want to duplicate. It seems that replacing CSVPrinter with some abstract interface and parameterizing CSV exporter with implementation of that interface will make possible to reuse the code of exporter for both CSV and Excel exports.

We prefer Apache POI library for writing Excel files, because it is already used in GanttProject.

Technical details

Relevant classes in GanttProject codebase:

  • GanttCSVExport -- the meat of CSV export, walks the project data, builds cell values and writes them using CSVPrinter
  • ExporterToCSV -- plugs into the export wizard UI
  • ExporterToImage -- sibling exporter which allows for choosing file type

Source code location

This feature should eventually be merged into master and published in one of the future versions. The base integration branch for pull requests is prj2_master. Please target on using Java 8.

Source code modification process

The process is described on GanttProject doc pages. Please do follow the code style and code review process.