SheetJS xlsx单元样式 [英] SheetJS xlsx-cell styling

查看:2186
本文介绍了SheetJS xlsx单元样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是此示例以导出工作表 https://github.com/SheetJS/js-xlsx/issues/817 .怎么做细胞 样式,例如背景色,字体大小和增加字体的宽度 单元格以使数据完全适合.我已经阅读了文档,但是找不到任何适合使用fill等的示例.有没有办法进行格式化?

I am referring this example to export a worksheet https://github.com/SheetJS/js-xlsx/issues/817. How to do cell styling like background coloring,font size and increasing the width of the cells to make the data fit exactly.I have gone through the documentation but couldn't find any proper examples to use fill etc.Is there a way to do the formatting?

Below is the code snippet:
    /* make the worksheet */
var ws = XLSX.utils.json_to_sheet(data);

/* add to workbook */
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "People");

/* write workbook (use type 'binary') */
var wbout = XLSX.write(wb, {bookType:'xlsx', type:'binary'});

/* generate a download */
function s2ab(s) {
    var buf = new ArrayBuffer(s.length);
    var view = new Uint8Array(buf);
    for (var i=0; i!=s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
    return buf;
}
saveAs(new Blob([s2ab(wbout)],{type:"application/octet- 
stream"}),"sheetjs.xlsx");

推荐答案

SheetJS的专业版.但是我认为您使用的是社区版本(免费版本). 无法使用社区版样式.

您可以在此处查看官方信息:

我们还提供了一个性能增强的专业版,另外 样式之类的功能,以及专门的支持.

We also offer a pro version with performance enhancements, additional features like styling, and dedicated support.

这篇关于SheetJS xlsx单元样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆