[](y,x)
          
          click to toggle source
          
        
        
        
          
          セルの値取り出し¶ ↑
sheet[行番号,カラム番号] でセルを参照する。
_y_::行番号(0始まり)
_x_::カラム番号(0始まり)
          
          
          
          
            
def [] y,x    
  cell = self.getCellByPosition(x,y)
  if cell.Type == 2 
    cell.String
  else
    cell.Value
  end
end
           
          
         
        
        
       
    
      
        
        
          []=(y,x,value)
          
          click to toggle source
          
        
        
        
          
          セルの値設定¶ ↑
sheet[行番号,カラム番号] でセルを参照する。
_y_::行番号(0始まり)
_x_::カラム番号(0始まり)
_value_::設定値
          
          
          
          
            
def []= y,x,value   
  cell = self.getCellByPosition(x,y)
  if value.class == String 
    cell.String = value
  else
    cell.Value= value
  end
end
           
          
         
        
        
       
    
      
        
        
          box(y1,x1,y2,x2)
          
          click to toggle source
          
        
        
        
          
          罫線枠設定¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
          
          
          
          
            
def box(y1,x1,y2,x2)
  r = self.getCellRangeByPosition(x1,y1,x2,y2)
  b = r.RightBorder
  b.InnerLineWidth = 10
  r.BottomBorder = b
  r.TopBorder = b
  r.LeftBorder = b
  r.RightBorder = b
end
           
          
         
        
        
       
    
      
        
        
          center(y1,x1)
          
          click to toggle source
          
        
        
        
          
          センター表示設定(Cell)¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
          
          
          
          
            
def center(y1,x1)
  self.horizontal(y1,x1,2)
end
           
          
         
        
        
       
    
      
        
        
          centers(y1,x1,y2,x2)
          
          click to toggle source
          
        
        
        
          
          センター表示設定(Range)¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
          
          
          
          
            
def centers(y1,x1,y2,x2)
  self.horizontals(y1,x1,y2,x2,2)
end
           
          
         
        
        
       
    
      
        
        
          color(y,x)
          
          click to toggle source
          
        
        
        
          
          セルの背景色を取得¶ ↑
_y_::行番号(0始まり)
_x_::カラム番号(0始まり)
ret::RGB24bitでの色コード
          
          
          
          
            
def color(y,x)  
    self.getCellByPosition(x,y).CellBackColor
end
           
          
         
        
        
       
    
      
        
        
          copy(sy1,sx1,sy2,sx2,ty,tx)
          
          click to toggle source
          
        
        
        
          
          コピー(Range)¶ ↑
_sy1_::コピー元 左上行番号(0始まり)
_sx1_::コピー元 左上カラム番号(0始まり)
_sy2_::コピー元 右下行番号(0始まり)
_sx2_::コピー元 右下カラム番号(0始まり)
_ty_::コピー先 左上行番号(0始まり)
_tx_::コピー先 左上カラム番号(0始まり)
          
          
          
          
            
def copy(sy1,sx1,sy2,sx2,ty,tx)
  r = self.getCellRangeByPosition(sx1,sy1,sx2,sy2).getRangeAddress
  c = self.getCellByPosition(tx,ty).getCellAddress
  self.copyRange(c,r)
end
           
          
         
        
        
       
    
      
    
      
    
      
    
      
        
        
          get_chartdoc(n=0)
          
          click to toggle source
          
        
        
        
          
          チャートドキュメント取り出し¶ ↑
_n_::何番目のチャートを取り出すかの指定(0始まり)、指定されない場合には 0。
ret::シートオブジェクト
          
          
          
          
            
def get_chartdoc(n=0)
  charts = self.getCharts
  if n.class == String
    chart = charts.getByName(n)
  else
    chart = charts.getByIndex(n)
  end
  chartDoc = chart.EmbeddedObject
  chartDoc.extend(CalcChartDoc)
end
           
          
         
        
        
       
    
      
    
      
        
        
          get_width(x)
          
          click to toggle source
          
        
        
        
          
          カラム幅取得¶ ↑
_x_::カラム番号(0始まり)
ret::幅(1/100mm単位)
          
          
          
          
            
def get_width(x)  
    self.Columns.getByIndex(x).Width
end
           
          
         
        
        
       
    
      
        
        
          group_column(x1,x2)
          
          click to toggle source
          
        
        
        
          
          列をグループ化¶ ↑
_y1_::開始列番号(0始まり)
_y2_::終了列番号(0始まり)
Excelのグループ化と+-のアイコンの位置が異なります。
          
          
          
          
            
def group_column(x1,x2)
  r = self.getCellRangeByPosition(x1,0,x2,0).RangeAddress
  self.group(r,0)
end
           
          
         
        
        
       
    
      
        
        
          group_row(y1,y2)
          
          click to toggle source
          
        
        
        
          
          行をグループ化¶ ↑
_y1_::開始行番号(0始まり)
_y2_::終了行番号(0始まり)
Excelのグループ化と+-のアイコンの位置が異なります。
          
          
          
          
            
def group_row(y1,y2)
  r = self.getCellRangeByPosition(0,y1,0,y2).RangeAddress
  self.group(r,1)
end
           
          
         
        
        
       
    
      
        
        
          horizontal(y1,x1,h=0)
          
          click to toggle source
          
        
        
        
          
          水平方向の表示設定(Cell)¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_h_:: 0:STANDARD,1:LEFT,2:CENTER,3:RIGHT,4:BLOCK,5:REPEAT
          
          
          
          
            
def horizontal(y1,x1,h=0)
  self.getCellByPosition(x1,y1).HoriJustify  = h
end
           
          
         
        
        
       
    
      
        
        
          horizontals(y1,x1,y2,x2,h=0)
          
          click to toggle source
          
        
        
        
          
          水平方向の表示設定(Range)¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
_h_:: 0:STANDARD,1:LEFT,2:CENTER,3:RIGHT,4:BLOCK,5:REPEAT
          
          
          
          
            
def horizontals(y1,x1,y2,x2,h=0)
  self.getCellRangeByPosition(x1,y1,x2,y2).HoriJustify  = h
end
           
          
         
        
        
       
    
      
        
        
          insert_rows(n,count=1)
          
          click to toggle source
          
        
        
        
          
          行の挿入¶ ↑
_n_:: 行番号(0始まり)、この行の前に挿入する。
_count_:: 何行挿入するかの指定、指定しない場合には1。
          
          
          
          
            
def insert_rows(n,count=1)   
  self.Rows.insertByIndex(n,count)
end
           
          
         
        
        
       
    
      
        
        
          merge(y1,x1,y2,x2)
          
          click to toggle source
          
        
        
        
          
          セルのマージ設定¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
          
          
          
          
            
def merge(y1,x1,y2,x2)
  self.getCellRangeByPosition(x1,y1,x2,y2).merge(true)
end
           
          
         
        
        
       
    
      
        
        
          merge_off(y1,x1,y2,x2)
          
          click to toggle source
          
        
        
        
          
          セルのマージ解除¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
          
          
          
          
            
def merge_off(y1,x1,y2,x2)
  self.getCellRangeByPosition(x1,y1,x2,y2).merge(false)
end
           
          
         
        
        
       
    
      
        
        
          r_str(y,x)
          
          click to toggle source
          
        
        
        
          
          範囲指定の文字列作成¶ ↑
_y_::行番号(0始まり)
_x_::カラム番号(0始まり)
ret::範囲指定文字列
          
          
          
          
            
def r_str(y,x)
  r = ''
  x -= 1
  if x > 26*26
    return "ZZ#{y}"
  else
    r = $a2z[((x/26)-1).to_i] if x > 25
    r += $a2z[(x%26).to_i]
    r += y.to_s
  end
  r
end
           
          
         
        
        
       
    
      
        
        
          remove_rows(n,count=1)
          
          click to toggle source
          
        
        
        
          
          行の削除¶ ↑
_n_:: 行番号(0始まり)、この行から下を削除する。
_count_:: 何行削除するかの指定、指定しない場合には1。
          
          
          
          
            
def remove_rows(n,count=1)   
  r = self.getCellRangeByPosition(0,n,0,n+count-1).getRangeAddress
  self.removerange(r,3)
end
           
          
         
        
        
       
    
      
        
        
          set_color(y,x,color)
          
          click to toggle source
          
        
        
        
          
          セルの背景色を設定¶ ↑
_y_::行番号(0始まり)
_x_::カラム番号(0始まり)
_color_::RGB24bitでの色コード
          
          
          
          
            
def set_color(y,x,color)  
    self.getCellByPosition(x,y).CellBackColor = color
end
           
          
         
        
        
       
    
      
    
      
        
        
          set_range_color(y1,x1,y2,x2,color)
          
          click to toggle source
          
        
        
        
          
          セル範囲の背景色を設定¶ ↑
_y1_::行番号(0始まり)
_x1_::カラム番号(0始まり)
_y2_::行番号(0始まり)
_x2_::カラム番号(0始まり)
_color_::RGB24bitでの色コード
          
          
          
          
            
def set_range_color(y1,x1,y2,x2,color) 
  self.getCellRangeByPosition(x1,y1,x2,y2).CellBackColor = color
end
           
          
         
        
        
       
    
      
        
        
          set_width(x,width)
          
          click to toggle source
          
        
        
        
          
          カラム幅設定¶ ↑
_x_::カラム番号(0始まり)
_width_::幅(1/100mm単位)
          
          
          
          
            
def set_width(x,width)  
    self.Columns.getByIndex(x).Width = width
end
           
          
         
        
        
       
    
      
        
        
          v_top(y1,x1)
          
          click to toggle source
          
        
        
        
          
          
          
          
          
          
            
def v_top(y1,x1)
  self.vertical(y1,x1,1)
end
           
          
         
        
        
       
    
      
        
        
          v_tops(y1,x1,y2,x2)
          
          click to toggle source
          
        
        
        
          
          上付き表示設定¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
          
          
          
          
            
def v_tops(y1,x1,y2,x2)
  self.verticals(y1,x1,y2,x2,1)
end
           
          
         
        
        
       
    
      
        
        
          vertical(y1,x1,v=0)
          
          click to toggle source
          
        
        
        
          
          
          
          
          
          
            
def vertical(y1,x1,v=0)
  self.getCellByPosition(x1,y1).VertJustify  = v
end
           
          
         
        
        
       
    
      
        
        
          verticals(y1,x1,y2,x2,v=0)
          
          click to toggle source
          
        
        
        
          
          垂直方向の表示設定¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
_v_:: 0:STANDARD,1:TOP,2:CENTER,3:BOTTOM
          
          
          
          
            
def verticals(y1,x1,y2,x2,v=0)
  self.getCellRangeByPosition(x1,y1,x2,y2).VertJustify  = v
end
           
          
         
        
        
       
    
      
        
        
          wrap(y1,x1,y2,x2)
          
          click to toggle source
          
        
        
        
          
          Wrap表示設定¶ ↑
_y1_::左上行番号(0始まり)
_x1_::左上カラム番号(0始まり)
_y2_::右下行番号(0始まり)
_x2_::右下カラム番号(0始まり)
          
          
          
          
            
def wrap(y1,x1,y2,x2)
  self.getCellRangeByPosition(x1,y1,x2,y2).IsTextWrapped = true
end