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

Fix output order of Sheet Properties #225

Merged
merged 1 commit into from
Dec 2, 2016

Conversation

keeneym
Copy link

@keeneym keeneym commented Nov 11, 2016

I noticed that when using both "tabColors" and "sheetViews" the resulting xlsx files end up being corrupt when trying to open in Microsoft Excel. After playing around a bit in the zip files I realized Excel is pretty picky about element order in the xml files, and it prefers to have the Sheet Properties before the Sheet Views.

Here is some example code that is corrupt before my change and opens fine after:

var wb = new Excel.stream.xlsx.WorkbookWriter({filename: "tabColorTest.xlsx", useSharedStrings: true});
var ws = wb.addWorksheet('blort', {
    properties: {
        tabColor: {argb: 'FFFF0000'}
    },
    views: [
        {
            state: 'frozen',
            ySplit: 1,
            topLeftCell:"A2"
        }
    ]
});

ws.getCell('A1').value = "frozenHeader";
ws.getCell('A2').value = "tabColorTest";
wb.commit();

@keeneym
Copy link
Author

keeneym commented Nov 17, 2016

@guyonroche Was I supposed to create an Issue for this? I'm a bit new to github, I'm not sure if you see incoming Pull Requests.

@guyonroche guyonroche merged commit aaca364 into exceljs:master Dec 2, 2016
@guyonroche
Copy link
Collaborator

@keeneym no need for an issue. Thanks for the contribution.

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

Successfully merging this pull request may close these issues.

2 participants