问题描述:

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

相关阅读:
Top