我已经寻找解决方案大约一天了。我仍然无法给出一个有效的例子。
我的问题很简单。我有一个映射器使用另一个映射器:
@Mapper(componentModel = "spring", uses = {RoleMapper.class})
public interface UserMapper {
/**
* Converts User DTO to User JPA Entity
* @Mapping annotation is used to convert fields with different names
* @param dto
* @return
*/
@Mappings({
@Mapping(target = "identityNo", source = "dto.userIdentity"),
@Mapping(target = "role", source = "dto.roleDTO")
})
User dtoToEntity(UserDTO dto);
/**
* Converts User JPA Entity to User DTO
* @Mapping annotation is used to convert fields with different names
* @param entity
* @return …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 poi 创建一个 docx 文件,但我无法为段落设置标题样式。
XWPFDocument document= new XWPFDocument();
//Write the Document in file system
FileOutputStream out = new FileOutputStream(new File("C:/Users/2/Desktop/RequirementModelDocument.docx"));
XWPFParagraph paragraph = document.createParagraph();
XWPFRun run=paragraph.createRun();
paragraph.setAlignment(ParagraphAlignment.LEFT);
paragraph.setStyle("Heading1");
run.setText(reqLevel.getName());
run.setBold(true);
run.setFontFamily("Calibri Light (Headings)");
Run Code Online (Sandbox Code Playgroud)
它就像忽略了这paragraph.setStyle("Heading1");条线。我看过 apache 的例子,但我看不到任何关于这个问题的例子。