Skip to main content

Zen of SheetJSSheetJS的禅

SheetJS design and development is guided by a few key principles.SheetJS的设计和开发遵循几个关键原则。

Data processing should fit in any workflow数据处理应适合任何工作流

The library does not impose a separate lifecycle. 该库没有强加单独的生命周期。It fits nicely in websites and apps built using any framework. 它非常适合使用任何框架构建的网站和应用程序。The plain JS data objects play nice with Web Workers and future APIs.简单的JS数据对象可以很好地与Web工作者和未来的API配合使用。

JavaScript is a powerful language for data processingJavaScript是一种强大的数据处理语言

The "Common Spreadsheet Format"“通用电子表格格式” is a simple object representation of the core concepts of a workbook. 是工作簿核心概念的简单对象表示。 The various functions in the library provide low-level tools for working with the object.库中的各种函数提供了处理对象的低级工具。

For friendly JS processing, there are utility functions for converting parts of a worksheet to/from an Array of Arrays. 对于友好的JS处理,有一些实用函数用于将工作表的部分转换为数组或从数组中转换。The Complete example combines powerful JS Array methods with a network request library to download data, select the information we want and create a workbook file:完整的示例将强大的JS数组方法与网络请求库相结合,以下载数据、选择所需信息并创建工作簿文件:

File formats are implementation details文件格式是实现细节

The parser covers a wide gamut of common spreadsheet file formats to ensure that "HTML-saved-as-XLS" files work as well as actual XLS or XLSX files.解析器涵盖了广泛的常见电子表格文件格式,以确保“HTML另存为XLS”文件与实际的XLS或XLSX文件一样工作。

The writer supports a number of common output formats for broad compatibility with the data ecosystem.为了与数据生态系统广泛兼容,作者支持许多常见的输出格式。

To the greatest extent possible, data processing code should not have to worry about the specific file formats involved.尽可能地,数据处理代码不必担心涉及的特定文件格式。