Total number of pages in MPP file

Greetings,

Can anyone provide me with a code snippet that I can use to find out the total number of pages in a given MPP file using Aspose.Tasks?

Thank you in advance.

Regards,
Syed.

Hi Syed,

Number of pages can vary with the change in font and size etc. This feature is not available at the moment but a request in this regard has been logged into our issue tracking system as TASKS-31988. We will keep you updated on this issue in this thread.

In the meantime, you can use the following formula as a workaround

Aspose.Tasks.Util.ChildTasksCollector collector = new Aspose.Tasks.Util.ChildTasksCollector();
Aspose.Tasks.Util.TaskUtils.Apply(project.RootTask, collector, 0);
int totalPages = collector.Tasks.Count / expectedNumberOfTasksOnOnePage;

Please feel free to contact us in case you have further comments or questions.

Best Regards,

Ijaz,

Thank you for the reply.

I am having some issue in generating the multipage TIFF file for a MPP file. Will it be possible for you to share some sample or an article that generates a multipage TIFF file for a given source MPP file?

Your help is greatly appreciated.

Regards,
Syed.

Hi Syed,

Sorry, export to multipage TIFF option is not available at the moment but an issue in this regard has been logged into our issue tracking system as TASKS-32184. We will keep you updated on this issue in this thread.

Please feel free to contact us in case you have further comments or questions.

Best Regards,

Ijaz,

I am facing a difficulty in exporting a MPP file to TIFF output. Lets say that I have a MPP file that will span on 5 pages (if we preview the file in Microsoft Project’s PrintPreview). My point is that how can I then generate the equivalent TIFF file for each page. Can you kindly share any sample code for this purpose? I need it on an urgent basis.

Regards,
Syed.

Hi Syed,

Please check this article Aspose.Total for .NET|Documentation to render 1 page. You can replace project.Export line with the following code if you want to render all the pages.

IRenderResult result = project.Export(RenderFormat.Image, PresentationFormat.GanttChart, "project0.tiff", new BaseImageRenderParam(null, new Point(), new Size(1200, 800), 100, 0, true), true, null, view);

for (int pageNumber = 1; pageNumber < result.NumberOfPages; pageNumber++)
{
    project.Export(RenderFormat.Image, PresentationFormat.GanttChart, "project"+i+".tiff", new BaseImageRenderParam(null, new Point(), new Size(1200, 800), 100, pageNumber, true), true, null, view);
}

Please feel free to contact us in case you have further comments or questions.

Best Regards,

Thank you for code snippet Ijaz. It worked pretty good.

I know that there known issues with the MS Project file support but I was wondering if you can help me out in achieving the following in the output TIFF file:

  1. Is it possible to achieve the functionality of column ‘AutoSize’ so that contents of each cell in a column are displayed in a single row?
  2. If not, then is it possible to truncate the content of the cells rather then cluttering the contents in the cells?
  3. Using the above code I can see that the columns included in the view are repeated on each page. Is it possible to restrict the column display to only the initial page or pages, depending upon the number of tasks?
  4. Is it possible to handle the alignment of content in the cells/columns?

Looking forward for an early reply.

Regards,
Syed.

Greetings,

The ProjectView that is created using the sample code mentioned in the technical article generates a view in which tasks are not sorted by ID. Can you kindly help me out to sort the tasks based on ID or if required on any column desired?

I am looking for an urgent reply.

Regards,
Syed.

Hi Syed,

Sorry, the mentioned features are not available at the moment. By default, the tasks are sorted by ID but you cannot sort the tasks by any specific column. This issue has been logged into our issue tracking system with ID 32490.

AutoSize and alignment issues have also been logged into our issue tracking system as 32491 and 32492 respectively. You can restrict the column display to only initial pages by reducing the width as you can see in the following code.

ProjectView view = new ProjectView(columns);
//Render to image
IRenderResult result = project.Export(RenderFormat.Image, PresentationFormat.GanttChart, "project0.tiff", new BaseImageRenderParam(null,
    new Point(), new Size(1200, 800), 100, 0, true), true, null, view);
int pageNumber;
for (pageNumber = 1; pageNumber < result.PagesInHeight; pageNumber++)
{
    project.Export(RenderFormat.Image, PresentationFormat.GanttChart, "project" + pageNumber + ".tiff", new BaseImageRenderParam(null,
        new Point(), new Size(1200, 800), 100, pageNumber, true), true, null, view);
}
columns.Clear();
columns.Add(new GanttChartColumn("Name", 1, new TaskToColumnTextConverter(prg.TaskName)));
ProjectView view1 = new ProjectView(columns);

for (pageNumber = result.PagesInHeight; pageNumber < result.NumberOfPages; pageNumber++)
{
    project.Export(RenderFormat.Image, PresentationFormat.GanttChart, "project" + pageNumber + ".tiff", new BaseImageRenderParam(null,
        new Point(), new Size(1200, 800), 100, pageNumber + 1, true), true, null, view1);
}

We will keep you updated on all these issues in this thread.

Best Regards,

The issues you have found earlier (filed as TASKS-32184) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as TASKS-32490;TASKS-32492) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.