You are here

function _sheetnode_phpexcel_batch_export_sheet in Sheetnode 7.2

Same name and namespace in other branches
  1. 6 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_batch_export_sheet()
  2. 7 modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc \_sheetnode_phpexcel_batch_export_sheet()

Batch API callback to export a single sheet to PHPExcel.

1 string reference to '_sheetnode_phpexcel_batch_export_sheet'
sheetnode_phpexcel_batch_export in modules/sheetnode_phpexcel/sheetnode_phpexcel.module
API function to batch export several sheets using Batch API.

File

modules/sheetnode_phpexcel/sheetnode_phpexcel.export.inc, line 32
Export sheetnodes through PHPExcel to xls or xlsx spreadsheets.

Code

function _sheetnode_phpexcel_batch_export_sheet($title, $socialcalc, $filename, $format, $destination, &$context) {
  if (empty($context['results']['workbook'])) {
    $workbook = new PHPExcel();
    $context['results']['workbook'] = serialize($workbook);
    $worksheet = $workbook
      ->getActiveSheet();
    $context['results'] += array(
      'filename' => $filename,
      'format' => $format,
      'destination' => $destination,
    );
  }
  else {
    $workbook = unserialize($context['results']['workbook']);
    $worksheet = $workbook
      ->createSheet($workbook
      ->getSheetCount());
  }
  _sheetnode_phpexcel_export_sheet($worksheet, $title, $socialcalc);
  $context['results']['workbook'] = serialize($workbook);
  $context['message'] = t('Processed sheet %sheet.', array(
    '%sheet' => $worksheet
      ->getTitle(),
  ));
}