普加項(xiàng)目管理中間件是用于跨瀏覽器和跨平臺(tái)應(yīng)用程序的功能齊全的 Gantt 圖表,可滿足項(xiàng)目管理應(yīng)用程序的所有需求,是最完善的甘特圖圖表庫。
同樣普加項(xiàng)目管理中間件提供了導(dǎo)出方法,可以導(dǎo)出XML格式的文件,這個(gè)文件可以在微軟project中直接打開展示。
var win = new PlusProject.ExportProjectWindow({
project: this.project
});
win.setData();
win.show();
后臺(tái)處理如下:
//1)導(dǎo)出為XML
Hashtable dataProject = new ProjectService().LoadProject(id);
string fileName = Path.GetFileNameWithoutExtension(Convert.ToString(dataProject["Name"])) + "_" + DateTime.Now.ToString("yyyyMMddHHmmss")+".";
string fileType = Request["type"];
if (string.IsNullOrEmpty(fileType))
{
fileType = "xml";
}
fileName += fileType;
string filePath = HttpContext.Current.Server.MapPath(@"~/Upload/" + fileName);
//導(dǎo)出自定義任務(wù)屬性
ExportExtendedAttributes(dataProject);
//對固定工期的摘要任務(wù),設(shè)置為手動(dòng)模式,以便在MSProject完整顯示。
ExportFixedDateSummarys(dataProject);
PluSoft.Utils.PlusProject.Write(filePath, dataProject);
//2)下載XML
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.WriteFile(filePath);
Response.Flush();
FileInfo file = new FileInfo(filePath);
file.Delete();
Response.End();
很多情況下,用戶會(huì)有一些自定義字段的展示,普加項(xiàng)目管理中間件也可以直接導(dǎo)出。但是使用的時(shí)候需要參考相關(guān)的說明來處理,示例代碼中有詳細(xì)的說明。