Skip to content

Keep the page setup print attributes when reading and writing - #427

Open
LuisFigueroaG wants to merge 1 commit into
MathNya:masterfrom
LuisFigueroaG:fix/page-setup-attributes
Open

LuisFigueroaG wants to merge 1 commit into
MathNya:masterfrom
LuisFigueroaG:fix/page-setup-attributes

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

PageSetup only kept paperSize, scale, orientation, fitToHeight, fitToWidth, horizontalDpi and verticalDpi, so a sheet with

<pageSetup paperSize="9" firstPageNumber="3" orientation="landscape" pageOrder="overThenDown" blackAndWhite="1" draft="1" cellComments="atEnd" useFirstPageNumber="1" errors="dash" copies="2"/>

was saved as <pageSetup paperSize="9" orientation="landscape"/>. The starting page number, page order, black and white and draft printing, how comments and errors are printed and the number of copies were all lost. A pageSetup element with only these attributes was dropped entirely, because the writer skips the element when none of the known attributes is set.

This adds getters/setters for firstPageNumber, useFirstPageNumber, pageOrder, blackAndWhite, draft, cellComments, errors and copies to PageSetup, with PageOrderValues, CellCommentsValues and PrintErrorValues for the enum attributes. The reader keeps them and the writer writes back the ones that are set. Getters return the defaults from the spec when an attribute is missing (firstPageNumber and copies default to 1). A new workbook, or a file without any of these attributes, is written exactly as before.

The added test inserts pageSetup in a saved workbook, reads it, checks the values, writes it again and checks the element. It also checks the defaults, the output for a new workbook and setting the attributes through the API.

PageSetup only read and wrote paperSize, scale, orientation, fitToHeight, fitToWidth, horizontalDpi and verticalDpi, so firstPageNumber, useFirstPageNumber, pageOrder, blackAndWhite, draft, cellComments, errors and copies were lost on a round trip. A pageSetup element with only these attributes was dropped entirely. Read these attributes, write back the ones that are set and add getters and setters for them, with PageOrderValues, CellCommentsValues and PrintErrorValues for the enum ones.
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.

1 participant