Free Support Forum - aspose.com

Is it possible to change date format in Start and Finish column?

Hi,


While converting any MPP to PDF, I can see that the Start and Finish date comes only in one specific format.

Is there any way to change this format in Aspose Tasks ?

Thanks,
Rajiv

Basically I would like to keep the same format as input file if possible …


Thanks,
Rajiv

Hi Rajiv,


Please consider the following sample code which displays the Finish date in formatted string. You may use any format to display the date.

Sample code:


private static Project prj = new Project(“D:/Aspose/output.mpp”);

public static void TestTaskDateFields()

{

SaveOptions options = new PdfSaveOptions();

options.setTimescale(Timescale.Months);

options.setView(ProjectView.getDefaultGanttChartView());

options.getView().getColumns().remove(4);

//options.getView().getColumns().remove(2);


options.getView().getColumns().add(new GanttChartColumn(“Finish”, 100, new TaskToColumnTextConverter() {

@Override

public String invoke(Task task)

{

return task.getFinish().toString();

}

}));



//options.View.Columns.Add(new GanttChartColumn(“Predecessors”, 100, new TaskToColumnTextConverter(TaskPredecessors)));


prj.save(“D:/Aspose/result GanttChart_Date_Java.pdf”, options);


}



Hi Kashif,


Sorry for coming back on this after a long time …

Is there a way to ‘retain’ the date format of Start and Finish columns from MPP file by any chance ? Can you point me to a Project class API to read the same if available …

Thanks,
Rajiv

Hi Rajiv,


Could you please share some sample differences between the date formats in the MPP and output PDF? I have compared both and the rendered PDF has the only difference of Year in 4 digits while remaining format is the same as that of the MPP. We’ll look into your requirements and assist you further accordingly.

Hi Kashif,


Ya it is about year format only, nothing else as far as the column is concerned …

Possible to retain the source file year format ?

Thanks,
Rajiv

Just came across another sample wherein the format is completely changed, not just the year.


DD-MM-YY became M/D/YYYY.

Just attaching sample. We would like to retain the complete format.

Thanks,
Rajiv

Hi Rajiv,


Currently reading of date/time format from source MPP is not supported. I have logged an enhancement ticket as id TASKS-33755 for providing feature to read the source MPP date/time format and render to PDF.

I will write back here once any update is available in this regard.

Hi Kashif,


Can you make TASKS-33755 ES under AjeshEMC (without moving the thread) ?

Thanks,
Rajiv

Hi Rajiv,

This task depends on MSProject.DateFormat property, which is not stored in mpp, but in MSProject application and
applies to any mpp file. Our development team is looking into this issue. I have further increased the priority of this issue to Enterprise level and you can track the status of this issue from EMC thread here.

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


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

This issue TASKS-33755 has been marked as fixed here, I tested 7.1 but I still don't see same date format being retained from input file while generating PDF. Input has DD-MM-YY, but output has M/D/YY. Looks like it is fixed only partically, i.e. year format has been changed from YYYY to YY.

Can you pls check and reopen the bug, try the sample I attached here in my comment on 09-16-2014, 2:17 PM.

This is really disappointing, since it was marked as fixed I thought we'll get the fix in 7.1.

Thanks,
Rajiv

Hi Rajiv,

The format of Date property is not stored in the MPP file but in MS Project application which then applies to all the MPP files. In order to get the date in specific output format, you may please use the Project’s DateFormat property as shown here. Please let us know if we can be of any additional help to you in this regard.

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