1.0.7 • Published 2 years ago

@ctsy/xlsx v1.0.7

Weekly downloads
7
License
ISC
Repository
github
Last release
2 years ago

@ctsy/xlsx

yarn add @ctsy/xlsx

读取文件 read xlsx file in brower

<!-- 现在可以不用手动写上传控件了,可以直接调用readAsJSON -->
<!-- <input type="file" name="" id="" @change="handleChange"> -->
<button @click="upload">导入(import)</button>
import { readAsJSON } from "@ctsy/xlsx";
async upload(e: any) {
    try{
        this.Loading = true;
        let rs = await readAsJSON(undefined,[{name:"标题",code:'键',default:'默认值'}]);
        // rs就是获得的结果
    }catch(e){

    }finally{

        this.Loading = false;
    }
}

导出文件 export xlsx file in brower

从table中导出数据,数据源为table内容 export from table

    writeFileFronTable('table标签的id值, the table element`s id','文件名称 filename.xlsx')

从JSON数据导出为xlsx文件 export from json

    wirteFileFromJSON({
        SheetName:[
            {Title:1,Value:2},
            {Title:1,Value:2},
            {Title:1,Value:2},
            {Title:1,Value:2},
            {Title:1,Value:2},
            {Title:1,Value:2}
        ]
    },'文件名称 filename.xlsx')
1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago