You are here

function socialcalc_cellformat_parselayout in Sheetnode 7

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

File

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

Code

function socialcalc_cellformat_parselayout($cell, $sheet) {
  if (empty($cell['layout'])) {
    return FALSE;
  }
  $parts = array();
  preg_match('/^padding:\\s*(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+);vertical-align:\\s*(\\S+);$/', $sheet['layouts'][$cell['layout']], $parts);
  $layout = array();
  if ($parts[1] != '*') {
    $layout['padtop'] = str_replace('px', '', $parts[1]);
  }
  if ($parts[2] != '*') {
    $layout['padright'] = str_replace('px', '', $parts[2]);
  }
  if ($parts[3] != '*') {
    $layout['padbottom'] = str_replace('px', '', $parts[3]);
  }
  if ($parts[4] != '*') {
    $layout['padleft'] = str_replace('px', '', $parts[4]);
  }
  if ($parts[5] != '*') {
    $layout['alignvert'] = $parts[5];
  }
  return $layout;
}