Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-tasks-gists/51fa245f0ab39913edde7943099e5771 to your computer and use it in GitHub Desktop.
Save aspose-tasks-gists/51fa245f0ab39913edde7943099e5771 to your computer and use it in GitHub Desktop.
Convert MPP to Excel using Java
// This code example demonstrates how to convert MPP to XLSX.
// Load the input Project file
Project project = new Project("D:\\Files\\Tasks\\Project.mpp");
// Save the Project as XLSX
project.save("D:\\Files\\Tasks\\Project.xlsx", SaveFileFormat.Xlsx);
// This code example demonstrates how to convert MPP to XLSX with advanced options.
// Load the input Project file
Project project = new Project("D:\\Files\\Tasks\\Project.mpp");
// Initialize XlsxOptions class object
XlsxOptions options = new XlsxOptions();
// Set the Timescale value to months
options.setTimescale(Timescale.Months);
// Set Gantt chart view
options.setView(ProjectView.getDefaultGanttChartView());
// Set page size
options.setPageSize(PageSize.A3);
// Render project to a single page
options.setRenderToSinglePage(true);
// Set UTF8 encoding
options.setEncoding(Charset.forName("UTF8"));
// Set resource sheet view
options.setResourceView(ProjectView.getDefaultResourceSheetView());
// Set assignment view
options.setAssignmentView(ProjectView.getDefaultAssignmentView());
// Set presentation format as resource usage
options.setPresentationFormat(PresentationFormat.ResourceUsage);
// Save the Project as XLSX
project.save("D:\\Files\\Tasks\\ProjectWithOptions.xlsx", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment