怎么给docx文档里的固定描述加底色,例如给文字和符号 [无] 加红色底色
首先怎么锁定文字呢,可以提供代码吗
@liufei951027 您的意思是您需要突出显示文档中某些特定的现有文本? 如果是这样,您可以使用查找/替换功能。 例如看下面的代码:
Document doc = new Document("C:\\Temp\\in.docx");
FindReplaceOptions opt = new FindReplaceOptions();
opt.setUseSubstitutions(true);
opt.getApplyFont().setHighlightColor(Color.YELLOW);
// The text "test" will be highlighted with yellow.
doc.getRange().replace("test", "$0", opt);
doc.save("C:\\Temp\\out.docx");