Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Plugin: Export XLSX

Dushusir edited this page Sep 11, 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.luckysheet_conditionformat_save: conditional formatting (dates and duplicate values are not supported)
  • sheet.luckysheet_alternateformat_save: alternate color (turned to background color)
  • sheet.dataVerification: data verification
  • sheet.images: images (fixed positioning not supported)
  • sheet.chart: chart (as image)
  • sheet.zoomRatio: zoom ratio
  • sheet.hide: whether to hide
  • sheet.name: name
  • sheet.frozen: Freeze
  • sheet.showGridLines: whether to show grid lines
  • sheet.filter_select: auto filter (only supports range)
  • sheet.color: sheet tab color
  • sheet.row: row count
  • sheet.column: column count

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
  • sheet.config.authority: sheet protection

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 Luckysheet front-end configuration opens the export button in the toolbar to ensure that the Luckysheet latest code on Github is packaged

Getting started with Luckysheet

How to manually package Luckysheet source code?

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.

  1. We use the offline activation method, which requires you to run it on the server
./lucky-export-linux -k true

You can print out the unique key value of the server and send this key value to us.

In addition, you need to send us the user name you registered on the official website.

  1. Get the license we gave you, replace the license file SecretKey.txt on the server 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.luckysheet_conditionformat_save:条件格式(日期和重复值不支持)
  • sheet.luckysheet_alternateformat_save:交替颜色(转为背景色)
  • sheet.dataVerification:数据验证
  • sheet.images:图片(固定定位不支持)
  • sheet.chart:图表(作为图片)
  • sheet.zoomRatio:缩放比例
  • sheet.hide:是否隐藏
  • sheet.name:名称
  • sheet.frozen:冻结
  • sheet.showGridLines:是否展示网格线
  • sheet.filter_select:自动筛选(只支持范围)
  • sheet.color: sheet标签颜色
  • sheet.row: 行数
  • sheet.column: 列数

worksheet配置

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

使用

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

Tips:如果要在Windows上执行,请使用

cd /software/lucky
# 当前窗口直接运行测试,-p 可以根据需要更改端口
lucky-export-win.exe -p 3001

4. 前端配置

Luckysheet前端配置开启工具栏的导出按钮,确保打包Github上 Luckysheet最新代码

Luckysheet入门

如何手动打包Luckysheet源码?

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

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

注意

体验完成之后,请及时联系销售购买永久License。

  1. 我们采用离线激活的方式,需要你在要部署的服务器上运行
./lucky-export-linux -k true

即可打印出服务器唯一key值,将这个key值发给我们。

另外还需要将你在官网注册的用户名发给我们。

2.拿到我们给你的License,替换服务器上的License 文件 SecretKey.txt 重启服务即可生效。