Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell value vertical alignment not working #148

Closed
th3ygen opened this issue Jul 9, 2020 · 0 comments
Closed

Cell value vertical alignment not working #148

th3ygen opened this issue Jul 9, 2020 · 0 comments

Comments

@th3ygen
Copy link

th3ygen commented Jul 9, 2020

Hello, I tried to align a merged cells value both vertically and horizontally. The value inside the cells did aligned but only horizontal.

Here's my code

const totalIndex = 3;
for (let x = 0; x < totalIndex; x++) {
    wb.Sheets.Data[`A${(x * 4) + 5}`] = { t: 's', v: `${x + 1}`,
        s: {
            fill: { style: 'solid', fgColor: { rgb: 'baff4c' } },
            border: {
                top: { style: 'thin', color: { rgb: '000' } },
                right: { style: 'thin', color: { rgb: '000' } },
                left: { style: 'thin', color: { rgb: '000' } },
            },
            alignment: {
                vertical: 'center', horizontal: 'center'
            }
        }
    };
    wb.Sheets.Data['!merges'].push({ s: { r: (x * 4) + 4, c: 0 }, e: { r: (x * 4) + 7, c: 0 }});

    wb.Sheets.Data[`A${(x * 4) + 6}`] = {
        s: {
            border: {
                left: { style: 'thin', color: { rgb: '000' } },
                right: { style: 'thin', color: { rgb: '000' } },
            }
        }
    };
    wb.Sheets.Data[`A${(x * 4) + 7}`] = {
        s: {
            border: {
                left: { style: 'thin', color: { rgb: '000' } },
                right: { style: 'thin', color: { rgb: '000' } },
            }
        }
    };
    wb.Sheets.Data[`A${(x * 4) + 8}`] = {
        s: {
            border: {
                left: { style: 'thin', color: { rgb: '000' } },
                right: { style: 'thin', color: { rgb: '000' } },
                bottom: { style: 'medium', color: { rgb: '000' } },
            }
        }
    };
}

Result
image

@th3ygen th3ygen closed this as completed Jul 9, 2020
saarCiklum pushed a commit to Folcon/js-xlsx that referenced this issue Aug 17, 2020
- README and example cleanup
- basic XLSB and ODS write support
- flow typecheck for ODS file
  Note: xlsx.js flow fails: facebook/flow#380
- exposed jszip compression (fixes SheetJS#220, closes SheetJS#284)

README issues:

|  id  | author         | comment                                      |
|-----:|:---------------|:---------------------------------------------|
| SheetJS#202 | @sao93859      | closes SheetJS#202                                  |
| SheetJS#211 | @alexanderchan | closes SheetJS#211 corrected examples               |
| SheetJS#327 | @cskaandorp    | changed saveAs example to match write tests  |
| SheetJS#424 | @dskrvk        | added note about s2roa h/t @LeonardoPatignio |
| SheetJS#496 | @jimmywarting  | closes SheetJS#496 adapted rABS examples with rAAS  |

ODS file format issues:

|  id  | author         | comment                                      |
|-----:|:---------------|:---------------------------------------------|
| protobi#148 | @user4815162342| closes protobi#148 h/t @ziacik                      |
| protobi#166 | @paulproteus   | closes protobi#166 rudimentary ODS write support    |
| protobi#177 | @ziacik        | closes protobi#177                                  |
| protobi#179 | @ziacik        | closes protobi#179 use JSON when available          |
| SheetJS#317 | @ziacik        | closes SheetJS#317                                  |
| SheetJS#328 | @think01       | closes SheetJS#328                                  |
| SheetJS#383 | @mdamt         | closes SheetJS#383 duplicate cells should be copied |
| SheetJS#430 | @RB-Lab        | closes SheetJS#430                                  |
| SheetJS#546 | @lgodard       | closes SheetJS#546 thanks to other changes          |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant