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

get_column_width_raw() handling default widths #379

Open
caramdache opened this issue Sep 15, 2020 · 0 comments
Open

get_column_width_raw() handling default widths #379

caramdache opened this issue Sep 15, 2020 · 0 comments

Comments

@caramdache
Copy link

I'm doing some pixel calculations using, so I use get_column_width_raw(). This works well, except for columns that have a defaut width. In this case, get_column_width_raw() returns null.

I've looked at the code for get_column_width(), it does handle default column widths, but not in pixel. Am I missing something? Is there any way for get_column_width_raw() to handle defaults widths? Would the following work?

def get_column_width_raw(column_index = 0)
  validate_workbook
  validate_nonnegative(column_index)

  range = cols.locate_range(column_index)
  if range
    range.width
  else
    RubyXL::ColumnRange::DEFAULT_WIDTH + 5.0 / RubyXL::Font::MAX_DIGIT_WIDTH
  end
end
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

1 participant