Преобразовать файл mpp Microsoft Project MPP
В этой статье описывается, как преобразовать файлы MPP Project Microsoft Project в различные форматы вывода, включая HTML, простой текст и шаблон Project Microsoft (MPT) с использованием Aspose.tasks для .NET. API предоставляет комплексный набор функций для настройки вывода, включая обработку ресурсов, настройки заголовка, параметры стиля и фильтрацию контента. Каждый формат покрыт практическими примерами и дополнительными этапами настройки.
Microsoft Project (MSP) позволяет разработчикам сохранять данные проекта (MPP/XML) в шаблонах HTML, текста и MPT. Aspose.tasks также позволяет сохранять данные проекта в тех же форматах, аналогичных MSP. Это достигается с использованием стандартного метода сохранения, выявленного классом Project.
Сохранить данные проекта как html
Класс HTMLSaveOptions позволяет разработчикам контролировать макет и содержание экспортируемых HTML -файлов. Он поддерживает многостраничный экспорт, конфигурацию размера страницы, выбор временного масштаба, а также внедрение или экстернализующие CSS, шрифты и изображения. Aspose.tasks может экспортировать данные проекта в формат HTML. Это позволяет сохранять все данные в HTML или экспорт только требуемые страницы в HTML, используя SavePtions, как показано в следующих образцах кода.
Controlling Header and Title Output in HTML
By default, the exported HTML document includes the project name in the HTML <title>
and in the document’s page header. You can disable either of these elements by modifying the corresponding properties of the HtmlSaveOptions
class.
Saving Fonts, Images and CSS Styles Separately
Aspose.Tasks supports saving fonts, images, and CSS styles as external files. This is particularly useful when you want to integrate HTML output into an existing website or manage styling separately from the content. This is achieved using the HtmlSaveOptions class by providing information about CSS, Font and Image destinations. The resource export behavior can be configured through HtmlSaveOptions.ExportFonts, ExportImages, and ExportCss.
Adding Custom Prefixes to CSS Class Names While Exporting to HTML
To avoid CSS class name conflicts when integrating the exported HTML into a broader application, you can define a custom prefix using the CssStylePrefix
property.
Save Project to Text
Project data can be exported to plain text using SaveFileFormat.TXT
. This format is intended for simple logging, debugging, or archival purposes.
Save Project Data as Template (MPT)
Aspose.Tasks allows saving a project as a Microsoft Project Template (MPT) file. This is useful when you want to create reusable project structures. Use the SaveAsTemplate
method and configure optional parameters through the SaveTemplateOptions
class to remove actual and baseline values.
Conclusion
Aspose.Tasks for .NET provides flexible and developer-friendly methods for exporting project data to multiple formats, including HTML, text, and templates. With the help of configuration classes such as HtmlSaveOptions and SaveTemplateOptions, developers can fine-tune the output to meet a wide range of business requirements. For additional details, refer to the API Reference or explore other export scenarios in the documentation.