未能与Apache POI得到的Word文档(.doc)/设定值复选框 [英] couldn't get/set checkbox value in Word document (.doc) with Apache POI

查看:812
本文介绍了未能与Apache POI得到的Word文档(.doc)/设定值复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图与Apache POI获得在Word文档(.doc)/设置复选框值。

I'm trying to get/set checkbox value in Word document (.doc) with Apache POI.

我看了 HWPFDocument 是在合适的 poi.apache.org ,但没有发现任何东西API ...
也许有人有办法解决吗?

I looked HWPFDocument API at poi.apache.org, but haven't found anything suitable... Maybe somebody have a solution?

感谢您!

推荐答案

不幸的是,这是目前不支持POI。什么工作通过<一个读出(未设置)下拉列表href=\"https://poi.apache.org/apidocs/org/apache/poi/hwpf/usermodel/CharacterRun.html#getDropDownListValues%28%29\"相对=nofollow> CharacterRun.getDropDownListValues​​() 和<一个href=\"https://poi.apache.org/apidocs/org/apache/poi/hwpf/usermodel/CharacterRun.html#getDropDownListDefaultItemIndex%28%29\"相对=nofollow> CharacterRun.getDropDownListDefaultItemIndex()

Unfortunately, this is currently not supported by POI. What does work is to read out (not set) dropdown lists via CharacterRun.getDropDownListValues() and CharacterRun.getDropDownListDefaultItemIndex().

技术上的下拉列表密切相关的复选框,虽然。因此它不应该太难以将各自的功能添加到POI,如果需要的话。您的入口点是一个 NilPICFAndBinData 结构(由在POI这个类)这导致你一些 FFData (映射到在POI该类)。里面,你会发现 FFDataBits 。这些最终包含 IRES 值EN codeS的复选框的状态。
- 这是完全一样的行为,作为下拉列表,只有FFDataBits的 ITYPE iTypeChck 的而不是 iTypeDrop ,且必须在一个稍微不同的方式PTED间$ p $。

Technically those dropdown lists are closely related to checkboxes, though. So it should not be too difficult to add the respective functionality to POI, if desired. Your entry point is a NilPICFAndBinData structure (handled by this class in POI), which leads you to some FFData (maps to this class in POI). Inside that you will find FFDataBits. These eventually contain an iRes value which encodes the status of that checkbox. - This is exactly the same behavior as for dropdown lists, only that the iType of FFDataBits will be iTypeChck instead of iTypeDrop and has to be interpreted in a slightly different way.

这篇关于未能与Apache POI得到的Word文档(.doc)/设定值复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆