Method: Spreadsheet::Excel::Reader#read_colinfo
- Defined in:
- lib/spreadsheet/excel/reader.rb
#read_colinfo(worksheet, work, pos, len) ⇒ Object
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/spreadsheet/excel/reader.rb', line 234 def read_colinfo worksheet, work, pos, len # Offset Size Contents # 0 2 Index to first column in the range # 2 2 Index to last column in the range # 4 2 Width of the columns in 1/256 of the width of the zero # character, using default font (first FONT record in the # file) # 6 2 Index to XF record (➜ 6.115) for default column formatting # 8 2 Option flags: # Bits Mask Contents # 0 0x0001 1 = Columns are hidden # 10-8 0x0700 Outline level of the columns (0 = no outline) # 12 0x1000 1 = Columns are collapsed # 10 2 Not used first, last, width, xf, opts = work.unpack binfmt(:colinfo)[0..-2] first.upto last do |col| column = Column.new col, @workbook.format(xf), width: width.to_f / 256, hidden: (opts & 0x0001) > 0, collapsed: (opts & 0x1000) > 0, outline_level: (opts & 0x0700) / 256 column.worksheet = worksheet worksheet.columns[col] = column end end |