<repositories> <repository> <id>com.e-iceblue</id> <name>e-iceblue</name> <url>https://repo.e-iceblue.cn/repository/maven-public/</url> </repository> </repositories> <dependency> <groupId>e-iceblue</groupId> <artifactId>spire.doc</artifactId> <version>4.11.3</version> </dependency>
import com.spire.doc.*; public static void main(String[] args) { String regex1 = "[a-zA-Z]+/[a-zA-Z]+"; //判断标记 System.out.println("DD/fdf".matches(regex1)); Document document = new Document(); document.loadFromFile("E:\\我的文件夹\\001 我的笔记\\013 MyBatis-Plus笔记.docx"); //计算字数 System.out.println("WordCount: " + document.getBuiltinDocumentProperties().getWordCount()); //计算没有空格的字符数 System.out.println("CharCount: " + document.getBuiltinDocumentProperties().getCharCount()); //计算带空格的字符数 System.out.println("CharCountWithSpace: " + document.getBuiltinDocumentProperties().getCharCountWithSpace()); }
站长微信:xiaomao0055
站长QQ:14496453