To prevent cell content not visible due to column width.#5
Open
wbtan7 wants to merge 6 commits intoglexey:masterfrom
Open
To prevent cell content not visible due to column width.#5wbtan7 wants to merge 6 commits intoglexey:masterfrom
wbtan7 wants to merge 6 commits intoglexey:masterfrom
Conversation
Usage:
to autofit all column
excel2img.export_img("test.xlsx", "test.png", "Sheet1", None, autofit=True)
to autofit certain range
excel2img.export_img("test.xlsx", "test.png", "Sheet1", None, _af_range="B1:Q5")
glexey
reviewed
Apr 28, 2020
excel2img/excel2img.py
Outdated
Comment on lines
108
to
112
| if autofit is not None: | ||
| excel.workbook.Application.Range(rng).Columns.AutoFit() | ||
| elif _af_range is not None: | ||
| excel.workbook.Application.Range(_af_range).Columns.AutoFit() | ||
|
|
Owner
There was a problem hiding this comment.
The meaning of autofit/_af_range function arguments as implemented is not consistent or intuitive, e.g.:
autofit=True, _af_range="A1:B2"will auto-fit everythingautofit=False, _af_range=Nonewill auto-fit everything
It would be better to have a single autofit option which you would check for truthiness, to do the autofit. Additionally, if autofit is an instance of str, interpret it as a range to autofit.
(it is ok to still have separate command line options, since argparse doesn't support optional option values)
glexey
reviewed
Apr 28, 2020
excel2img/excel2img.py
Outdated
| parser.add_option('-p', '--page', help='pick a page (sheet) by page name. When not specified (and RANGE either not specified or doesn\'t imply a page), first page will be selected') | ||
| parser.add_option('-r', '--range', metavar='RANGE', dest='_range', help='pick a range, in Excel notation. When not specified all used cells on a page will be selected') | ||
| parser.add_option('-af', '--autofit', help='Autofit the column') | ||
| parser.add_option('-afr', '--autofitr', metavar='RANGE', dest='_af_range', help='Autofit the column based on range provided') |
Owner
There was a problem hiding this comment.
Better long option name would be --autofit-range
This reverts commit 9015320.
Usage:
to autofit all column
excel2img.export_img("test.xlsx", "test.png", "Sheet1", None, autofit=True)
to autofit certain range
excel2img.export_img("test.xlsx", "test.png", "Sheet1", None, _af_range="B1:Q5")
Author
|
Thanks for the comment, I updated the commits, do reply if changes is needed . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Usage:
to autofit all column
excel2img.export_img("test.xlsx", "test.png", "Sheet1", None, autofit=True)
to autofit certain range
excel2img.export_img("test.xlsx", "test.png", "Sheet1", None, _af_range="B1:Q5")