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

Allow setting a cell's min_width and max_width properties #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/prawn/table/cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ def max_width
#
attr_writer :height

# Manually specify the cell's min_width
#
attr_writer :min_width

# Manually specify the cell's max_width
#
attr_writer :max_width

# Specifies which borders to enable. Must be an array of zero or more of:
# <tt>[:left, :right, :top, :bottom]</tt>.
#
Expand Down
3 changes: 2 additions & 1 deletion lib/prawn/table/cell/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ def set_width_constraints
unless defined?(@min_width) && @min_width
min_content_width = [natural_content_width, styled_width_of_single_character].min
@min_width = padding_left + padding_right + min_content_width
super
end

super
end

protected
Expand Down