[英]How to make MPXJ-Library show work column in mpp File using Java
I'm doing an internal Project, in Java, where i have to read an Excel and Parse it into a mpp respectively a MS Project compatible.xml file.我正在做一个内部项目,在 Java 中,我必须在其中读取一个 Excel 并将其解析为一个 mpp 分别是一个 MS Project compatible.xml 文件。 I'm creating the file and everythings working fine.
我正在创建文件,一切正常。 But i want to show the columns "Work" and "ID" by default.
但我想默认显示“工作”和“ID”列。
I can show them in MS Projects and the values are as I expect them to be, but i have to select and show them.我可以在 MS Projects 中显示它们,并且值与我期望的一样,但我必须 select 并显示它们。 Is there a possibility to show them by default when you open the.xml file?
打开 .xml 文件时是否可以默认显示它们?
I tried a lot and searched:我尝试了很多并搜索:
as well as StackOverflow.以及 StackOverflow。 But i didn't found any Information helping me out or it wasn't helpful cause methods changed and i didn't found the equivalent new ones.
但是我没有找到任何帮助我的信息,或者它没有帮助,因为方法改变了,我没有找到等效的新方法。
this is where i fill the tasks and resources of my mpp.这是我填写我的 mpp 的任务和资源的地方。
if (!extractedRow.getElement().isEmpty())
{
element = contract.addTask();
element.setName(extractedRow.getElement());
element.setStart(startingDate);
element.setOutlineLevel(LookUp.Mpp_Conversion_Element_OutlineLevel());
element.setID(id++);
}
else if (!extractedRow.getWorkpackage().isEmpty())
{
workpackage = Objects.requireNonNull(element).addTask();
workpackage.setName(extractedRow.getWorkpackage());
workpackage.setOutlineLevel(LookUp.Mpp_Conversion_Workpackage_OutlineLevel());
workpackage.setID(id++);
}
else if (!extractedRow.getTask().isEmpty())
{
task = Objects.requireNonNull(workpackage).addTask();
task.setName(extractedRow.getTask());
task.setType(TaskType.FIXED_WORK);
task.setOutlineLevel(LookUp.Mpp_Conversion_Task_OutlineLevel());
task.setWork(Duration.getInstance(extractedRow.getEstimatedTime(), TimeUnit.HOURS));
task.setDuration(Duration.getInstance(extractedRow.getEstimatedTime() / 8, TimeUnit.DAYS));
task.setRemainingWork(Duration.getInstance(extractedRow.getEstimatedTime(), TimeUnit.HOURS));
task.setID(id++);
if (!extractedRow.getRole().isEmpty())
{
for (Resource resource : _project.getResources())
{
if (resource.getName().equals(_filereader.get_mapper().getMapping(extractedRow.getRole())))
{
assn = Objects.requireNonNull(task).addResourceAssignment(resource);
assn.setStart(task.getStart());
assn.setWork(Duration.getInstance(extractedRow.getEstimatedTime(), TimeUnit.HOURS));
}
}
}
}
Kind Regards亲切的问候
Unfortunately using an MPP file is the only way for you to specify the visual appearance of a schedule automatically when it is opened by Microsoft Project.不幸的是,使用 MPP 文件是您在 Microsoft Project 打开时自动指定日程表视觉外观的唯一方法。
You have a few options:你有几个选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.