Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Plugin: Export XLSX

Dushusir edited this page May 25, 2023 · 35 revisions

EN 【中文文档在下方】

Introduction

Luckysheet export as XLSX file, the front end passes in the Luckysheet json, and the back end returns the XLSX file stream.

Online experience address: Luckysheet Export Demo

Function

The following Luckysheet configurations already support exporting to xlsx files

Cell

sheet.data[row][column]

  • v: the original value of the content
  • bg: background
  • ff: font
  • fc: font color
  • bl: bold font
  • it: font italic
  • fs: font size
  • cl: enable strikethrough
  • ht: center horizontally
  • vt: vertical center
  • tr: text rotation
  • tb: Text word wrapping
  • ct: number format
  • f: formula (Dynamic arrays do not support)
  • ps: comments
  • rich text

worksheet properties

  • sheet.defaultRowHeight: default row height
  • sheet.defaultColWidth: default column width
  • sheet.hyperlink: hyperlink
  • sheet.images: images (fixed positioning not supported)
  • sheet.chart: chart (as image)

worksheet configuration

  • sheet.config.borderInfo: border
  • sheet.config.merge: merge cells
  • sheet.config.rowlen: row height
  • sheet.config.columnlen: column width
  • sheet.config.rowhidden: hide rows
  • sheet.config.colhidden: Hidden columns

workbook configuration

  • scaling ratio
  • Maximum line number
  • Maximum column number
  • Activate now
  • sheet name
  • Activate selection
  • Horizontal scroll bar position
  • Vertical scroll bar position

Usage

1. Download the export plugin

Download the export plug-in compressed package, unzip the executable file lucky-export-linux and the temporary License file SecretKey.txt, which can be used to deploy to the linux server

Address: Luckysheet Plugin Download

2. Upload to server

Use an FTP tool such as FileZilla to transfer the lucky-export-linux and SecretKey.txt files to any empty directory on the server, such as the /software/lucky directory

Fix Permission denied issue

cd /software/lucky
chmod 777 lucky-export-linux

3. Start the service

startup parameters

  • -p: port, [optional]
  • -c: cross-domain settings, the domain name to open access, [optional]

linux

cd /software/lucky
# Run the test directly in the current window, -p can change the port as needed
./lucky-export-linux -p 3001

# Keep running in the background
nohup ./lucky-export-linux -p 3001
 >lucky-export-linux.out 2>&1 &

After execution, Ctrl+C can exit the interaction

Check whether the startup is successful

ps aux | grep lucky-export-linux

4. Front-end configuration

The front end of Luckysheet already supports the export button on the toolbar through configuration

luckysheet. create({
     plugins:[{
         name: 'exportXlsx',
         config:{
             url:'http://[YOUR_SERVER_IP]:3001/luckyToXlsx'
         }
     }]
})

Among them, you need to update your own server interface address url

Notice

After the experience is complete, please contact sales to purchase a permanent license in time. Replace the License file SecretKey.txt and restart the service to take effect.


ZH

介绍

Luckysheet导出为XLSX文件,前端传入Luckysheet json,后端返回XLSX文件流。

在线体验地址:Luckysheet 导出 Demo

功能

以下Luckysheet的配置已支持导出到xlsx文件

单元格

sheet.data[row][column]

  • v: 内容的原始值
  • bg: 背景
  • ff: 字体
  • fc: 字体颜色
  • bl: 字体加粗
  • it: 字体斜体
  • fs: 字体大小
  • cl: 启用删除线
  • ht: 水平居中
  • vt: 垂直居中
  • tr: 文字旋转
  • tb: 文本自动换行
  • ct: 数字格式
  • f: 公式(动态数组不支持)
  • ps: 批注
  • 富文本

worksheet属性

  • sheet.defaultRowHeight:默认行高
  • sheet.defaultColWidth:默认列宽
  • sheet.hyperlink:超链接
  • sheet.frozen:冻结
  • sheet.filter:筛选
  • sheet.dataVerification:数据验证
  • sheet.images:图片(固定定位不支持)
  • sheet.chart:图表(作为图片)

worksheet配置

  • sheet.config.borderInfo:边框
  • sheet.config.merge:合并单元格
  • sheet.config.rowlen:行高
  • sheet.config.columnlen:列宽
  • sheet.config.rowhidden:隐藏行
  • sheet.config.colhidden:隐藏列
  • sheet.config.authority:工作表保护

workbook配置

  • 缩放比例
  • 最大行号
  • 最大列号
  • 是否激活
  • sheet 名称
  • 激活选区
  • 横向滚动条位置
  • 竖向滚动条位置

使用

1. 下载导出插件

下载导出插件压缩包,解压出可执行文件 lucky-export-linux 和 临时 License 文件 SecretKey.txt,可用于部署到linux服务器上

地址:Luckysheet 插件下载

2. 上传到服务器

使用 FTP 工具比如 FileZilla,传输 lucky-export-linuxSecretKey.txt 文件到服务器任意空白目录,比如/software/lucky目录下

修复 Permission denied 问题

cd /software/lucky
chmod 777 lucky-export-linux

3. 启动服务

启动参数

  • -p: 端口,[可选]
  • -c: 跨域设置,要开放访问的域名,[可选]

linux

cd /software/lucky
# 当前窗口直接运行测试,-p 可以根据需要更改端口
./lucky-export-linux -p 3001
# 保持后台运行
nohup ./lucky-export-linux -p 3001 >lucky-export-linux.out 2>&1 &

执行后 Ctrl+C 退出交互即可

查询是否启动成功

ps aux|grep lucky-export-linux

4. 前端配置

Luckysheet前端已经支持通过配置开启工具栏的导出按钮

luckysheet.create({
    plugins:[{
        name:'exportXlsx',
        config:{
            url:'http://[YOUR_SERVER_IP]:3001/luckyToXlsx'
        }
    }]
})

其中需要更新自己服务器接口地址url

注意

体验完成之后,请及时联系销售购买永久License。替换 License 文件 SecretKey.txt 重启服务即可生效。

Clone this wiki locally