如何使用apache poi检查.xlsx文件中的单元格文本是否有删除线 [英] How to check a cell text is strikethrough or not in .xlsx file using apache poi

查看:53
本文介绍了如何使用apache poi检查.xlsx文件中的单元格文本是否有删除线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要检查 .xlsx 文件(Microsoft Excel 文件)中单元格的文本格式是否删除或未使用 Apache POI 图书馆.

I need to check the text format of a cell in .xlsx file (Microsoft Excel file) is strike through or not using Apache POI libraries.

看下图

请检查这张图片!

我需要检查 B3 单元格文本是否删除.

I need to check whether B3 Cell text is strike through or not.

推荐答案

终于找到方法了,代码如下

Finally I found a way to do this, code as follow

//Using workbook
XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(new File("abc.xlsx")));
//Getting first sheet
XSSFSheet sheet = workbook.getSheetAt(0);
//Checking A1 cell that strikethrough or not
boolean strikeOutStatus=sheet.getRow(0).getCell(0).getCellStyle().getFont().getStrikeout();
System.out.println(strikeOutStatus); 

这篇关于如何使用apache poi检查.xlsx文件中的单元格文本是否有删除线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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