当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Apache poi XWPFRun doesn't have isDoubleStrikeThrough method

问题描述:

Now i'm using poi 3.11.

org.apache.poi.hwpf.usermodel.CharacterRun (for *.doc files) has both isStrikeThrough() and isDoubleStrikeThrough(),

but org.apache.poi.xwpf.usermodel.XWPFRun(for *.docx files) has only isStrike() method.

Why?

it seems that isStrike() method can't detect double-struck state.

i know that double-struck state can be detected with this implementation below

instanceOfXWPFRun.getCTR().getRPr().isSetDstrike()

but it is not pleasant for me. Are there any unified interfaces, classes or methods?

网友答案:

You need to use a newer version of Apache POI. (3.12 beta 1 will do you when it's out, for now a nightly / svn build)

If you look at the latest JavaDocs for XWPFRun, you'll see that there are methods isDoubleStrikeThrough() and setDoubleStrikethrough(boolean)

These two are also available on the common CharacterRun interface, which is shared between HWPF's CharacterRun and XWPF's XWPFRun

分享给朋友:
您可能感兴趣的文章:
随机阅读: