protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
817 stars 417 forks source link

Add ability to freeze and split sheet views #50

Open st-sloth opened 7 years ago

st-sloth commented 7 years ago

Added a new key in the Worksheet Object for freezing and splitting views.

I'm not sure whether !viewPane is the best name for this object. Neither that it should be an object instead of an array of objects. XSD says that there can only be one Pane in a SheetView but there can be multiple SheetView's in a Worksheet. However, write_ws_xml only creates one SheetView for a Worksheet anyway. Please, advise.

Some kudos to https://github.com/guyonroche/exceljs that helped to locate required feature in xml structure.

Also changed strip_sourcemap.sh used in make dist so it doesn't fail in Linux with GNU sed.

loku7 commented 6 years ago

Hi st-sloth, Are your changes merged into the main Branch of Js-xlsx? If it is merged can you please tell me how to use it? I am trying to implement freeze panes in my project.

st-sloth commented 6 years ago

Hi loku7, It is not. I didn't even open a PR for the main project, only this "styling" fork, because I need styling cells anyway. But the maintainers haven't answered. But there is yet another fork - https://github.com/xSirrioNx/js-xlsx - where the maintainer there tries to resolve conflicts and merge the features from this "styling" fork onto the diverged main codebase.

My PR hasn't been merged into protobi/js-xlsx, and my project uses a branch directly from my fork. But xSirrioNx/js-xlsx/pull/3 has been merged into xSirrioNx/js-xlsx. So you can use either. Like this

worksheet['!viewPane'] = {
    state: 'frozen',
    xSplit: 0,
    ySplit: 1
};

The documentation is present in README - https://github.com/xSirrioNx/js-xlsx#worksheet-object.

loku7 commented 6 years ago

Hi st-sloth, I used this ( https://github.com/xSirrioNx/js-xlsx ) fork it is working fine for me. Thanks for the help.