title: openpyxl 'NoneType' object has no attribute 'font'
body: <p>I'm writing a function that puts values into a spreadsheet and colors the cell based on the value. Now for some reason I'm getting a weird 'NoneType' error that's completely stumping me: </p>
  
  <pre><code>Traceback (most recent call last):
    File "vix.py", line 168, in &lt;module&gt;
      printexceldaily(1990, 2015, 'All_Lows', 10, 15, 18, 28)
    File "vix.py", line 166, in printexceldaily
      xlbook.save('%s.xlsx' % sheetname)
    File "/usr/local/lib/python3.4/dist-packages/openpyxl/workbook/workbook.py", line 281, in save
      save_workbook(self, filename)
    File "/usr/local/lib/python3.4/dist-packages/openpyxl/writer/excel.py", line 214, in save_workbook
      writer.save(filename)
    File "/usr/local/lib/python3.4/dist-packages/openpyxl/writer/excel.py", line 197, in save
      self.write_data(archive)
    File "/usr/local/lib/python3.4/dist-packages/openpyxl/writer/excel.py", line 98, in write_data
      archive.writestr(ARC_STYLE, self.style_writer.write_table())
    File "/usr/local/lib/python3.4/dist-packages/openpyxl/writer/styles.py", line 39, in write_table
      self._write_cell_xfs(number_format_node, fonts_node, fills_node, borders_node)
    File "/usr/local/lib/python3.4/dist-packages/openpyxl/writer/styles.py", line 159, in _write_cell_xfs
      font = st.font
  AttributeError: 'NoneType' object has no attribute 'font'
  </code></pre>
  
  <p>I tried looking at the code in styles.py and excel.py to see if I could figure out what might be causing it but I can't really make sense of any of it.</p>
  
  <p>Here's my code: </p>
  
  <pre><code>def printexceldaily(startyear, endyear, sheetname, start, hold, buy, end):
  
  xlbook = Workbook()
  xsheet = xlbook.active
  xsheet.title = sheetname
  colors = colorlist()
  comparisonlist = comparisonmap(start, hold, buy, end)
  length = len(comparisonlist)
  
  # fill a list with a style for every element of colors using coloredcell
  styles = [coloredcell(color) for color in colors] 
  
  def getstyle(value):
      for ceiling in comparisonlist:
          if value &lt; ceiling: 
              z = np.where(comparisonlist==ceiling)
              return styles[z[0]]
          elif value &gt; comparisonlist[length - 1]: # we need to check if value is greater than upper bound too
              return styles[length - 1]
  
  # create the cells for days
  for i in range(2, 32):
      xsheet.cell(row = 1, column = i).value = i
  
  xlrow = endyear - startyear + 2
  for year in range(startyear, endyear):
      for month in range(12):
          xsheet.cell(row = xlrow, column = 1).value = "%s, %d" % (xltomonth[month+1], year)
          for day in range(monthlim[month + 1]):
              curdatestr = '%d-%d-%d' % (year, month + 1, day + 1)
              try:
                  curx = vix.loc[curdatestr, 'Low']
              except KeyError:
                  xsheet.cell(row = xlrow, column = day+2).value = np.nan
              else:
                  xsheet.cell(row = xlrow, column = day+2).value = curx #add value to cell
                  xsheet.cell(row = xlrow, column = day+2).style = getstyle(curx) #add style to cell
  
          xlrow += 1
  print('saving')
  xlbook.save('%s.xlsx' % sheetname)
  </code></pre>
  
  <p>I've gotten a very similar "printexcelmonthly()" function working that I can post if it would be helpful but for some reason this one keeps bugging out when I try to save the spreadsheet o_O</p>