uniapp匯入匯出Excel

2022-05-19 16:27:51 字數 2465 閱讀 8984

外掛程式git:

匯出excel,走的是系統io流,**如下:dateutil.js的**點這裡

<

template

>

<

view

class

="content"

>

<

view

class

="top_box"

>}

view

>

<

view

class

="btn_cube"

@click

="tabletoexcel"

>匯出乙個表來看

view

>

<

view

class

="tip"

>tips:合併什麼的可以直接用table標籤相關的行內屬性合併,如colspan、rowspan

view

>

<

view

class

="tip"

>tips:建立目錄時,乙個大目錄,下面再有一級年月的目錄,方便到時候讀取目錄

view

>

<

view

class

="tip"

>}

view

>

view

>

template

>

<

script

>

import from

'@/common/util/dateutil.js

'var

that

export

default

},onload() ,

methods:

]//列標題

let worksheet ='

sheet1

'let str ='

姓名**郵箱'

//迴圈遍歷,每行加入tr標籤,每個單元格加td標籤

for(let i =0

; i

<

jsondata.length; i

++)

<

/td>`

} str +='

'}//let template =`

<

html xmlns:o="

urn:schemas-microsoft-com:office:office

"xmlns:x="

urn:schemas-microsoft-com:office:excel

"xmlns="

">

<

head

>

<

/head>$<

/table

><

/body><

/html

>

`

//exportfile(template)}}}

//匯出檔案到手機 filedata:要寫入到檔案的資料,返回引數為文件路徑

function

exportfile(filedata, documentname ='

專案excel檔案

') ,(err)=>)

console.log(

'開始匯出資料********')

//建立資料夾

rootobj.getdirectory(documentname, ,

function

(direntry) 年$月`, ,

function

(direntry2) .xlsx`, ,

function

(fileentry) )

}///storage/emulated/0指的就是系統路徑

let pathstr

=fullpath.replace(

'/storage/emulated/0',

'')writer.onwrite

=(e)

=>

) that.successtip

=`檔案位置:$/$

/$年$月`

}, 500)

}//寫入內容;

tips:手機上不比電腦,如果要除錯如上功能,建議下個辦公軟體,比如wps手機版,這樣找excel檔案就比較快。

excel匯入匯出

匯出 yii框架中 header content disposition attachment filename 123.xls arr connection createcommand select from recruit queryall array this db get recruit r...

EXCEL匯入匯出

系統管理員登入,系統下資源管理 分機號列表內容匯出 suppresswarnings rawtypes responsebody public jsonobject selectfenjihaoinxitongforexportbyparam requestparam value fenjihao ...

excel匯入匯出

匯出 匯出相對比較簡單在控制層的關鍵 為 string filename 成果資料 dateutils.getdate yyyymmddhhmmss xlsx listpersonneltitlelist personneltitleservice.findlist personneltitle n...