Home  >  Article  >  Web Front-end  >  How to use js-xlsx to merge cells

How to use js-xlsx to merge cells

php中世界最好的语言
php中世界最好的语言Original
2018-03-12 15:02:0010975browse

This time I will show you how to use s-xlsx to merge cells, and what are the precautions for using s-xlsx to merge cells. The following is a practical case, let's take a look.

Import data observation data format

1.1. Let’s first create an xlsx table with merged cells

Let’s take the example of header data merging:

How to use js-xlsx to merge cells


Example

1.2. Write a simple data import function (you can refer to the article in the preface to write it, I will not put the code )

Import xlsx reference data format:

Example

How to use js-xlsx to merge cells

##1.3. Check the official website instructions


How to use js-xlsx to merge cells

Official website example (http://sheetjs.com/demos/modify.html):



Official website example

How to use js-xlsx to merge cells

According to the official website description, we can simply see that the data format of merged cells is:

........
data["!merges"] = [{
                s: {//s为开始
                    c: 1,//开始列
                    r: 0//可以看成开始行,实际是取值范围
                },
                e: {//e结束
                    c: 4,//结束列
                    r: 0//结束行
                }
            }];
........

2. Hands-on experiment

2.1. Write a simple Export demo


    
    

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Related reading:

How to use s-xlsx to import and export Excel files (Part 2)

How to use s-xlsx -xlsx implements Excel file import and export (Part 1)

The above is the detailed content of How to use js-xlsx to merge cells. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn