Adjust time unit

When rendering MS Project documents GroupDocs.Viewer tries to find optimal output size and time unit depending on the project’s overall length. In case you need to set your own page size or time unit, you can set ProjectManagementOptions class properties of corresponding HtmlViewOptions (or JpgViewOptions, or PngViewOptions, or PdfViewOptions) class as shown in code samples below. Time unit refers to the smallest unit (days, third of a month or month) used in timescale bar. When the TimeUnit.Days is selected, you will get the most detailed view of your tasks. Whereas, when TimeUnit.Month is selected, you will get the more general representation of tasks.

The TimeUnit enumeration contains the following members:

  • Unknown - The unknown, unspecified time scale
  • Days - The one day interval
  • ThirdsOfMonths - The one third of the month
  • Months - The one month interval

The following are the steps to be followed to set time interval:

The following code samples show how to render MS Project document by time intervals.

using (Viewer viewer = new Viewer("sample.mpp"))
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
    viewOptions.ProjectManagementOptions.TimeUnit = TimeUnit.Days;