Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active September 2, 2021 10:57
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-com-gists/6268d176bd53cc58f9e210d92e250476 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/6268d176bd53cc58f9e210d92e250476 to your computer and use it in GitHub Desktop.
Convert MS Project MPP to XAML Format using C#
// Load the MPP file
Project project = new Project("SourceDirectory\\Tasks\\project_test.mpp");
// Save the MPP file as XAML
project.Save("OutputDirectory\\SaveProjectAsXAML_out.xaml", SaveFileFormat.XAML);
// Load the MPP file
Project project = new Project("SourceDirectory\\Tasks\\project_test.mpp");
// Initialize the XamlOptions class
SaveOptions options = new XamlOptions();
options.FitContent = true;
options.LegendOnEachPage = false;
options.Timescale = Timescale.ThirdsOfMonths;
// Save the MPP file as XAML
project.Save("OutputDirectory\\SaveProjectAsXAMLWithOptions_out.xaml", options);
// Load the MPP file
Project project = new Project("SourceDirectory\\Tasks\\project_test.mpp");
// Initialize the XamlOptions class
SaveOptions options = new XamlOptions();
options.PresentationFormat = PresentationFormat.GanttChart;
// Save the MPP file as XAML
project.Save("OutputDirectory\\RenderDifferentPresentationFormatsToXAML_out.xaml", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment