Impression de fichiers de projet Microsoft

Aspose.Tasks pour .NET fournit la facilité d’imprimer des projets à l’imprimante par défaut ou à toute imprimante personnalisée à l’aide de la fonction Project.print. Il offre également des fonctionnalités d’impression avancées telles que la modification des options d’impression et des paramètres.

Données d’impression du projet

La classe Project expose la fonction Print pour imprimer le projet. La fonction d’impression utilise PrintOptions pour définir différents paramètres pour l’impression comme Timescale, startDate, enddate, fitContent, LegendonEachPage et plus. Une autre classe (à partir de System.Drawing.print Espace de noms), Printersettings est utilisé pour configurer l’imprimante pour imprimer toutes les pages, Page Start (FromPage), Page End (Topage), Papersize et ainsi de suite. Les objets des imprimations et des imprimations sont transmis à project.print () pour l’impression finale.

Pour imprimer un projet:

  1. Chargez un fichier de projet Microsoft.
  2. Appelez la fonction d’impression avec les arguments spécifiés.

Imprimez à l’imprimante par défaut

Les lignes de code suivantes montrent comment y parvenir en utilisant C #.

1Project project = new Project("New Project.mpp");
2project.Print();
1Project project = new Project("New Project.mpp");
2foreach (string printer in PrinterSettings.InstalledPrinters)
3{
4    if (printer.ToUpperInvariant().Contains( "Microsoft Print to PDF".ToUpperInvariant()))
5    {
6        project.Print(printer);
7        break;
8    }
9}
1Project project = new Project("New Project.mpp");
2PrintOptions options = new PrintOptions();
3options.Timescale = Timescale.ThirdsOfMonths;
4if (project.GetPageCount(Timescale.ThirdsOfMonths) <= 280)
5    project.Print(options);
 1Project project = new Project("New Project.mpp");
 2
 3PrintOptions options = new PrintOptions();
 4options.Timescale = Timescale.Months;
 5
 6// Print first two pages
 7PrinterSettings printerSettings = new PrinterSettings();
 8printerSettings.PrintRange = PrintRange.SomePages;
 9printerSettings.FromPage = 1;
10printerSettings.ToPage = 2;
11
12System.Drawing.Printing.PageSettings pageSettings = printerSettings.DefaultPageSettings;
13pageSettings.PaperSize = new PaperSize("Custom Size", 1000, 700);
14project.Print(printerSettings, options);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.