一、效果
二、相关代码
1.引入包
pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>faea-area</artifactId>
<version>1.0-SNAPSHOT</version>
<name>faea-area</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.version>3.5.0</maven.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<java.version>1.8</java.version>
<fastjson.version>1.2.60</fastjson.version>
<lombok.version>1.18.8</lombok.version>
<logback.version>1.2.3</logback.version>
<poi.version>4.1.1</poi.version>
<guava.version>23.0</guava.version>
<hutool.version>5.3.10</hutool.version>
</properties>
<dependencies>
<!-- poi office -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi.version}</version>
</dependency>
<!--json格式化-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<!--google 工具类-->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<!--hutool工具类-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
</dependencies>
</project>
2.读取数据写入excel
部分代码如下:?
?
下载地址
源码下载地址:全国最新省市区街道数据获取-Java文档类资源-CSDN下载包含城市编码、省区域编码、省、市区域编码、市、区/县区域编码、区/县、街道区域编码街道数据的Ex更多下载资源、学习资料请访问CSDN下载频道.https://download.csdn.net/download/u011837804/85299098
如果您只需要一次那可以直接下载excel:
2022全国省、市、区、街道最新(20220506)Excel整理-Java文档类资源-CSDN下载包含城市编码、省区域编码、省、市区域编码、市、区/县区域编码、区/县、街道区域编码街道数据的Ex更多下载资源、学习资料请访问CSDN下载频道.https://download.csdn.net/download/u011837804/85055819
|