You are here

function socialcalc_cellformat_parsefont in Sheetnode 7

Same name and namespace in other branches
  1. 5 socialcalc.inc \socialcalc_cellformat_parsefont()
  2. 6 socialcalc.inc \socialcalc_cellformat_parsefont()
  3. 7.2 socialcalc.inc \socialcalc_cellformat_parsefont()
1 call to socialcalc_cellformat_parsefont()
_sheetnode_phpexcel_export_sheet in modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc
Helper function to export a single spreadsheet.

File

./socialcalc.inc, line 714
SocialCalc manipulation functions Translated from socialcalc-3.js and companion files

Code

function socialcalc_cellformat_parsefont($cell, $sheet) {
  if (empty($cell['font'])) {
    return FALSE;
  }
  $parts = array();
  preg_match('/^(\\*|\\S+? \\S+?) (\\S+?) (\\S.*)$/', $sheet['fonts'][$cell['font']], $parts);
  $font = array();
  if ($parts[3] != '*') {
    $font['family'] = $parts[3];
  }
  if ($parts[2] != '*') {
    $font['size'] = $parts[2];
  }
  if ($parts[1] != '*') {
    $font['bold'] = strpos($parts[1], 'bold') !== FALSE;
    $font['italic'] = strpos($parts[1], 'italic') !== FALSE;
  }
  return $font;
}