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

Set sheet margins #167

Closed
georgemeng-cfwt opened this issue Aug 9, 2019 · 5 comments
Closed

Set sheet margins #167

georgemeng-cfwt opened this issue Aug 9, 2019 · 5 comments

Comments

@georgemeng-cfwt
Copy link

Is there a way to set worksheet margin?

I would create a Excel file and setup everything so user could open and print. Now I could almost do anything I would but margin.

I checked all functions and could not find a method to set margin.

Is there a way to do it?

@cfsimplicity
Copy link
Owner

Hi, can you just confirm that what you want to do is set the page margins of a specified sheet when printed?

If so then yes, that should be possible. I will need to create some new methods to handle that.

@georgemeng-cfwt
Copy link
Author

Thanks!
When creating a worksheet, currently the margin will be default and no way to change it. It would be good to adjust the margin.

Currently I extend the cfc to call setMargin method of POI, but it would be to have the function inside the library.

@cfsimplicity
Copy link
Owner

OK, I'll try and add support for that in the develop branch as soon as I get time. My instinct is to have separate methods for each type of margin, e.g. setSheetTopMargin(), setSheetFooterMargin() etc.

@cfsimplicity
Copy link
Owner

I've added 6 new methods:

setSheetTopMargin( workbook, marginSize[, sheetName[, sheetNumber] ] )
setSheetBottomMargin( workbook, marginSize[, sheetName[, sheetNumber] ] )
setSheetLeftMargin( workbook, marginSize[, sheetName[, sheetNumber] ] )
setSheetRightMargin( workbook, marginSize[, sheetName[, sheetNumber] ] )
setSheetHeaderMargin( workbook, marginSize[, sheetName[, sheetNumber] ] )
setSheetFooterMargin( workbook, marginSize[, sheetName[, sheetNumber] ] )

Could you please download the develop branch and test? Thanks.

@georgemeng-cfwt
Copy link
Author

It worked perfectly! Thank you very much!

@cfsimplicity cfsimplicity changed the title Set Margin Set sheet margins Aug 9, 2019
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

2 participants