2021
09-16
09-16
C# 使用Word模板导出数据的实现代码
使用NPOI控件导出数据到Word模板中方式:效果如下:Word模板:运行结果:实现如下:Student.csusingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceExportWord{publicclassStudent{publicStringPhoto{get;set;}publicFileStreamPhotoData{ge...
继续阅读 >
一、基于框架1.IDEIntelliJIDEA2.软件环境Springbootmysqlmybatisorg.apache.poi二、环境集成1.创建springboot项目工程略过2.maven引入poi<!--数据导出依赖excel--><!--https://mvnrepository.com/artifact/org.apache.poi/poi--><dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>3.17</version></dependency><!--https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-->...
最近用mysql导出表数据到excel文件,mysql中的datetime类型导出到excel(excel2016)中被excel识别成它自己默认的日期格式了,在mysql中的格式形如yyyy-mm-ddhh:mm:ss,到了excel变成了yyyy/m/dh:mm,看起来不太习惯,当然可以通过设置excel单元格格式改成自定义格式yyyy-mm-ddhh:mm:ss,但是这样多了一个步骤,能不能直接从mysql导出到excel的就是mysql显示的样式呢?当然可以。开始猜想是由于mysql中该字段是datetime类型...