Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-micro
Commits
7eec3a61
Commit
7eec3a61
authored
Jul 13, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化导入导出工具栏
parent
eb7d7c1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
ExcelImporter.php
src/Tools/ExcelImporter.php
+9
-0
Exporter.php
src/Tools/Exporter.php
+18
-1
No files found.
src/Tools/ExcelImporter.php
View file @
7eec3a61
...
...
@@ -208,6 +208,15 @@ class ExcelImporter
return
$this
->
highestRow
;
}
/**
* 获取总列数
* @return int
*/
public
function
getHighestColumn
()
{
return
$this
->
highestColumn
;
}
/**
* 返回文件本地地址
* @return string
...
...
src/Tools/Exporter.php
View file @
7eec3a61
...
...
@@ -272,7 +272,7 @@ class Exporter
'borders'
=>
[
'allBorders'
=>
[
'borderStyle'
=>
Border
::
BORDER_THIN
,
'color'
=>
[
'argb'
=>
'
666
'
],
'color'
=>
[
'argb'
=>
'
000000
'
],
],
],
'alignment'
=>
[
...
...
@@ -286,6 +286,23 @@ class Exporter
$this
->
sheet
->
getStyle
(
$pRange
)
->
applyFromArray
(
$styleArray
);
}
/**
* 设置列宽
* @param int $width 不传为自动宽度
*/
public
function
setColumnWidth
(
int
$width
=
null
)
{
$end
=
$this
->
sheet
->
getHighestColumn
();
$end
++
;
for
(
$i
=
'A'
;
$i
!==
$end
;
$i
++
)
{
if
(
$width
)
{
$this
->
sheet
->
getColumnDimension
(
$i
)
->
setWidth
(
$width
);
}
else
{
$this
->
sheet
->
getColumnDimension
(
$i
)
->
setAutoSize
(
true
);
}
}
}
/**
* 下载导出的文件
* @param int $downloadType 下载形式 支持 Exporter::DOWNLOAD_TYPE_STREAM Exporter::DOWNLOAD_TYPE_RETURN_FILE_PATH Exporter::DOWNLOAD_TYPE_SAVE_AND_DOWNLOAD
...
...
Write
Preview
Markdown
is supported
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