Skip to content

get_column_width_raw() handling default widths #379

Open

Description

@caramdache

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions