用java 写.mpp文件
我要代码 能不能把那包传给我 我的QQ是641680466 邮箱liujun_wangyi@163.com 谢谢ProjectFile file =new ProjectFile();
Task task1 = file.addTask();
task1.setName("task1");
task1.setUniqueID(1);
task1.setID(1);
int a = 0;
if (null != task1.getOutlineLevel()) {
a = task1.getOutlineLevel();
}
task1.setOutlineLevel(a+1);
Task task11 = task1.addTask();
task11.setName("task1-1");
task11.setDuration(Duration.getInstance(6, TimeUnit.DAYS));
task11.setStart(java.sql.Date.valueOf("2008-8-21"));
task11.setFinish(java.sql.Date.valueOf("2008-8-26"));
task11.setPercentageComplete(NumberUtility.getDouble(90D));
task11.setUniqueID(2);
task11.setID(2);
task11.setResourceNames("one");
Task task12 = task1.addTask();
task12.setName("task12");
task12.setDuration(Duration.getInstance(5, TimeUnit.DAYS));
task12.setStart(java.sql.Date.valueOf("2008-8-27"));
task12.setFinish(java.sql.Date.valueOf("2008-8-31"));
task12.setResourceNames("two");
task12.setUniqueID(3);
task12.setID(3);
Relation r=task12.addPredecessor(task11);
r.setType(RelationType.FINISH_START);
r.setTaskUniqueID(task11.getUniqueID());
ProjectCalendar pc=file.addBaseCalendar();
pc.setName("压榨民工");
pc.setWorkingDay(Day.SUNDAY, true);
pc.setWorkingDay(Day.MONDAY, true);
pc.setWorkingDay(Day.TUESDAY, true);
pc.setWorkingDay(Day.WEDNESDAY, true);
pc.setWorkingDay(Day.THURSDAY, true);
pc.setWorkingDay(Day.FRIDAY, true);
pc.setWorkingDay(Day.SATURDAY, true);
ProjectCalendarHours h1=pc.addCalendarHours(Day.SUNDAY);
h1.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START1, ProjectCalendar.DEFAULT_END1));
h1.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START2, ProjectCalendar.DEFAULT_END2));
ProjectCalendarHours h2=pc.addCalendarHours(Day.MONDAY);
h2.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START1, ProjectCalendar.DEFAULT_END1));
h2.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START2, ProjectCalendar.DEFAULT_END2));
ProjectCalendarHours h3=pc.addCalendarHours(Day.TUESDAY);
h3.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START1, ProjectCalendar.DEFAULT_END1));
h3.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START2, ProjectCalendar.DEFAULT_END2));
ProjectCalendarHours h4=pc.addCalendarHours(Day.WEDNESDAY);
h4.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START1, ProjectCalendar.DEFAULT_END1));
h4.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START2, ProjectCalendar.DEFAULT_END2));
ProjectCalendarHours h5=pc.addCalendarHours(Day.THURSDAY);
h5.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START1, ProjectCalendar.DEFAULT_END1));
h5.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START2, ProjectCalendar.DEFAULT_END2));
ProjectCalendarHours h6=pc.addCalendarHours(Day.FRIDAY);
h6.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START1, ProjectCalendar.DEFAULT_END1));
h6.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START2, ProjectCalendar.DEFAULT_END2));
ProjectCalendarHours h7=pc.addCalendarHours(Day.SATURDAY);
h7.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START1, ProjectCalendar.DEFAULT_END1));
h7.addDateRange(new DateRange (ProjectCalendar.DEFAULT_START2, ProjectCalendar.DEFAULT_END2));
ProjectHeader ph=file.getProjectHeader();
ph.setCalendarName(pc.getName());
MPXWriter writer = new MPXWriter();
writer.setLocale(Locale.CHINESE);
writer.write(file, filename);
这个代码错在什么地方 --------------------编程问答-------------------- 至少把报的错发下吧 --------------------编程问答-------------------- 要读写.mpp文件需要安装相应版本的Project,如果仅仅是观看MPP文件,可以下载名为Steelray Project Viewer的软件,下载地址:http://www.steelray.com/download.php
--------------------编程问答-------------------- 就是在windows下打开文件的时候 不能打开 程序写入是没异常
打开的时候 就说没有驱动 --------------------编程问答-------------------- 无法打开 --------------------编程问答-------------------- 我的也是 --------------------编程问答-------------------- 我试过了 好像也是出现同样的问题
补充:Java , Java EE