VSRonin / QtXlsxWriter

.xlsx file reader and writer for Qt5
http://qtxlsx.debao.me
209 stars 73 forks source link

[WIP] Write sheet and cell protection info #25

Closed 7lb closed 1 year ago

7lb commented 6 years ago

This adds the Worksheet::isSheetProtected and Worksheet::setSheetProtected APIs.

It also correctly writes sheet and cell protection data to the xml files inside the xlsx archive.

This is based on ECMA-376-1:2016 sections 18.3.1.84 and 18.8.33

7lb commented 6 years ago

I still need to implement password protection, but the basic functionality should be there.

I followed the existing pattern of a getter and a setter for each flag, but from a design standpoint I believe using QFlags should be preferred.

It would at least reduce the amount of boilerplate code, but it would probably need to be done across the whole codebase to maintain consistency, and of course it would be a breaking change API-wise, so it's probably best to leave it to a future version.

I marked the PR as WIP in the meantime.

Edit: I missed your edit about ISO/IEC 29500. I will check it out and change the references in the code when I look at how to implement password protection

VSRonin commented 6 years ago

Thanks a lot for your work. I agree the original author of this library used bools instead of binary flags a lot but I can't find it in me to like this, it screams to be a flag. This is not a reject of the pull request though