Class: NameRecord

Inherits:
BiffRecord show all
Defined in:
lib/surpass/biff_record.rb

Overview

This record is part of a Link Table. It contains the name and the token

array of an internal defined name. Token arrays of defined names
contain tokens with aberrant token classes.

Record NAME, BIFF5/BIFF7:
Offset      Size    Contents
   0          2     Option flags, see below
   2          1     Keyboard shortcut (only for command macro names, see below)
   3          1     Length of the name (character count, ln)
   4          2     Size of the formula data (sz)
   6          2     0 = Global name, otherwise index to EXTERNSHEET record (one-based)
   8          2     0 = Global name, otherwise index to sheet (one-based)
  10          1     Length of menu text (character count, lm)
  11          1     Length of description text (character count, ld)
  12          1     Length of help topic text (character count, lh)
  13          1     Length of status bar text (character count, ls)
  14         ln     Character array of the name
14+ln        sz     Formula data (RPN token array without size field, 4)

14+ln+sz lm Character array of menu text

 var.        ld     Character array of description text
 var.        lh     Character array of help topic text
 var.        ls     Character array of status bar text

Record NAME, BIFF8:
Offset      Size Contents
   0          2  Option flags, see below
   2          1  Keyboard shortcut (only for command macro names, see below)
   3          1  Length of the name (character count, ln)
   4          2  Size of the formula data (sz)
   6          2  Not used
   8          2  0 = Global name, otherwise index to sheet (one-based)
  10          1  Length of menu text (character count, lm)
  11          1  Length of description text (character count, ld)
  12          1  Length of help topic text (character count, lh)
  13          1  Length of status bar text (character count, ls)
  14        var. Name (Unicode string without length field, 3.4)
 var.        sz  Formula data (RPN token array without size field, 4)
[var.]      var. (optional, only if lm > 0) Menu text (Unicode string without length field, 3.4)
[var.]      var. (optional, only if ld > 0) Description text (Unicode string without length field, 3.4)
[var.]      var. (optional, only if lh > 0) Help topic text (Unicode string without length field, 3.4)
[var.]      var. (optional, only if ls > 0) Status bar text (Unicode string without length field, 3.4)

Constant Summary collapse

RECORD_ID =
0x0018

Constants inherited from BiffRecord

BiffRecord::BIFF_LIMIT, BiffRecord::CONTINUE_RECORD_ID

Instance Attribute Summary

Attributes inherited from BiffRecord

#record_data

Instance Method Summary collapse

Methods inherited from BiffRecord

#record_header, #to_biff

Constructor Details

#initialize(options, keyboard_shortcut, name, sheet_index, rpn, menu_text = '', desc_text = '', help_text = '', status_text = '') ⇒ NameRecord

Returns a new instance of NameRecord.



2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
# File 'lib/surpass/biff_record.rb', line 2108

def initialize(options, keyboard_shortcut, name, sheet_index, rpn, menu_text='', desc_text='', help_text='', status_text='')
  if name.is_a?(Integer)
    unicode_name = [name].pack('c')
  else
    unicode_name = name
  end
  
  args = [options, keyboard_shortcut, unicode_name.length, rpn.length]
  args += [0x0000, sheet_index, 0x00]
  args += [menu_text.length, desc_text.length, help_text.length, status_text.length]
  args += [unicode_name, rpn]
  
  @record_data = args.pack('vCCv vvC vvvv b*') + menu_text + desc_text + help_text + status_text
end