Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
22eac10b
Commit
22eac10b
authored
Jul 01, 2022
by
季圣华
Browse files
优化excel工具类
parent
d3536646
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/utils/ExcelUtils.java
View file @
22eac10b
package
com.jsh.erp.utils
;
import
java.io.File
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
jxl.*
;
import
org.springframework.util.StringUtils
;
import
jxl.Cell
;
import
jxl.Sheet
;
import
jxl.Workbook
;
import
jxl.format.*
;
import
jxl.write.Label
;
import
jxl.write.WritableCellFormat
;
...
...
@@ -211,6 +207,21 @@ public class ExcelUtils {
}
}
public
static
String
getDateContent
(
Sheet
src
,
int
rowNum
,
int
colNum
)
{
// 日期 类型的处理
Cell
c
=
src
.
getRow
(
rowNum
)[
colNum
];
if
(
CellType
.
DATE
.
equals
(
c
.
getType
()))
{
DateCell
dc
=
(
DateCell
)
c
;
Date
jxlDate
=
dc
.
getDate
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
sdf
.
setTimeZone
(
TimeZone
.
getTimeZone
(
"GMT"
));
return
sdf
.
format
(
jxlDate
);
}
else
{
String
dateStr
=
c
.
getContents
().
trim
();
return
dateStr
;
}
}
/**
* 从第i行开始到最后检测指定列的唯一性
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment