Java 读取 Word文本、段落格式属性

本文介绍了如何使用free spire.doc.jar 3.9.0库来读取Word文档中的文本和段落格式。通过textrange.getCharacterFormat()可以获取文本的字体、字号、颜色等属性,而paragraph.getFormat()则用于获取段落的缩进、对齐方式、边框等设置。提供了一个详细的样式属性列表,并附带了Java示例代码以供参考。
摘要由CSDN通过智能技术生成
  • Work库:free spire.doc.jar 3.9.0

通过textrange.getCharacterFormat()方法读取文本字符串格式,通过paragraph.getFormat()读取段落格式,读取具体文字及段落属性时,可支持读取字体、字号、文字颜色、文字背景、文字是否加粗或倾斜、文字下划线、大小写、边框、上标下标、行距、段落缩进、对齐方式、段落边框、背景等等,下表中罗列了所有可支持读取的样式属性,供参考:

读取文本格式 getCharacterFormat():

方法

类型

getFontName()

String

getFontNameAscii()

String

getFontNameBidi()

String

getFontNameFarEast()

String

getFontNameNonFarEast()

String

getBold()

boolean

getFontSize()

float

getHighlightColor()

Color

getItalic()

boolean

getTextBackgroundColor()

Color

getTextColor()

Color

getAllCaps()

boolean

getAllowContextualAlternates()

boolean

getBidi()

boolean

getBoldBidi()

boolean

getBorder()

Border

getCharacterS

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值