Export workbook
@function
547453
function doExport() {
		/*
			If opts is array of arrays then this is a
			multisheet workboook, else it is a singlesheet
		*/
		if (typeof opts == 'object' && Array.isArray(opts)) {
			if (data && data.length > 0) {
				data.forEach(function(dat, idx) {
					prepareSheet(opts[idx], dat, undefined, idx + 1);
				});
			}
		} else {
			prepareSheet(opts, data, columns, 1);
		}

		saveWorkbook(cb);
	}
1083533
def _write_export(export, file_obj=None):
    

    if file_obj is None:
        return export

    if hasattr(file_obj, 'write'):
        out_file = file_obj
    else:
        out_file = open(file_obj, 'wb')
    try:
        out_file.write(export)
    except TypeError:
        out_file.write(export.encode('utf-8'))

    out_file.close()

    return export
385174
def export(datastore_key, calc_id=-1, exports='csv', export_dir='.'):
        
    dstore = util.read(calc_id)
    parent_id = dstore['oqparam'].hazard_calculation_id
    if parent_id:
        dstore.parent = util.read(parent_id)
    dstore.export_dir = export_dir
    with performance.Monitor('export', measuremem=True) as mon:
        for fmt in exports.split(','):
            fnames = export_((datastore_key, fmt), dstore)
            nbytes = sum(os.path.getsize(f) for f in fnames)
            print('Exported %s in %s' % (general.humansize(nbytes), fnames))
    if mon.duration > 1:
        print(mon)
    dstore.close()
718475
static List<IDataModel> toDataModels(final Workbook book, final String function) {
        if (book == null || function == null) { return emptyList(); }
        List<IDataModel> list = new LinkedList<>();

        final FormulaParsingWorkbook parsingBook = create((XSSFWorkbook) book);
        
        Sheet s = book.getSheetAt(0); /* TODO: only one sheet is supported */
        for (Row r : s) {
            for (Cell c : r) {
                if (c == null || CELL_TYPE_FORMULA != c.getCellType()) { continue; }

                try {
                    if (ConverterUtils.isFunctionInFormula(c.getCellFormula(), function))
                        { list.add(createDataModelFromCell(s, parsingBook, fromRowColumn(c.getRowIndex(), c.getColumnIndex()))); } }
                catch (FormulaParseException e) { log.warn("Warning while parsing excel formula. Probably this is OK.", e); }
            }
        }
        
        return list;
    }
1171
function (exports) {

    var exp = undefined;

    // retrieve the export object
    exports.forEach(function (_export) {

        // Linz's default export function is called export
        if (_export.action && _export.action === 'export') {
            exp = _export;
        }

    });

    // if the export object could not be found, throw an error
    if (!exp) {
        throw new Error('The export was using Linz default export method, yet the model\'s list.export object could not be found.');
    }

    return exp;

}
586325
function(exports, module, require, __filename)
    {
        Promise.resolve(
            ${o}
        ).then(
            function(o)
            {
                return o(function(o){return o(document);})
            }
        ).then(
            function(require) // actually import but require will get overwritten
            {
                ${bundles}.then(
                    function()
                    {
                        require(${ main }).then(
                            function(_module)
                            {
                                // this is needed for data-module support
                                if(typeof _module === "function") {
                                    // load, config, register, resolve
                                    _module(Promise.resolve(require), exports, module, __filename);
                                }
                            }
                        );
                    }
                );
            }
        );
    }
312914
private function buildExportJobs($export, TemporaryFile $temporaryFile, string $writerType): Collection
    {
        $sheetExports = [$export];
        if ($export instanceof WithMultipleSheets) {
            $sheetExports = $export->sheets();
        }

        $jobs = new Collection;
        foreach ($sheetExports as $sheetIndex => $sheetExport) {
            if ($sheetExport instanceof FromCollection) {
                $jobs = $jobs->merge($this->exportCollection($sheetExport, $temporaryFile, $writerType, $sheetIndex));
            } elseif ($sheetExport instanceof FromQuery) {
                $jobs = $jobs->merge($this->exportQuery($sheetExport, $temporaryFile, $writerType, $sheetIndex));
            }

            $jobs->push(new CloseSheet($sheetExport, $temporaryFile, $writerType, $sheetIndex));
        }

        return $jobs;
    }
800686
def export_to_xlsx(table, filename_or_fobj=None, sheet_name="Sheet1", *args, **kwargs):
    """"""

    workbook = Workbook()
    sheet = workbook.active
    sheet.title = sheet_name
    prepared_table = prepare_to_export(table, *args, **kwargs)

    # Write header
    field_names = next(prepared_table)
    for col_index, field_name in enumerate(field_names):
        cell = sheet.cell(row=1, column=col_index + 1)
        cell.value = field_name

    # Write sheet rows
    _convert_row = _python_to_cell(list(map(table.fields.get, field_names)))
    for row_index, row in enumerate(prepared_table, start=1):
        for col_index, (value, number_format) in enumerate(_convert_row(row)):
            cell = sheet.cell(row=row_index + 1, column=col_index + 1)
            cell.value = value
            if number_format is not None:
                cell.number_format = number_format

    return_result = False
    if filename_or_fobj is None:
        filename_or_fobj = BytesIO()
        return_result = True

    source = Source.from_file(filename_or_fobj, mode="wb", plugin_name="xlsx")
    workbook.save(source.fobj)
    source.fobj.flush()

    if return_result:
        source.fobj.seek(0)
        result = source.fobj.read()
    else:
        result = source.fobj

    if source.should_close:
        source.fobj.close()

    return result
882447
def export(fn):
    
    mod = sys.modules[fn.__module__]
    if hasattr(mod, '__all__'):
        mod.__all__.append(fn.__name__)
    else:
        mod.__all__ = [fn.__name__]
    return fn
813247
public static void exportFileToDOM(DocumentBuilder stringdb, BaseTable table, Document doc, Element elRoot)
    {
        try   {
            table.close();
            while (table.hasNext())
            {
            	table.next();
            	Record record = table.getRecord();
                XmlUtilities.createXMLRecord(stringdb, record, doc, elRoot);
            }
            elRoot.appendChild(doc.createTextNode(NEWLINE));
        } catch (DBException ex)    {
            ex.printStackTrace();
            System.exit(0);
        }
    }
776522
def load_exports(self, args=None):
        """"""
        if args is None:
            return False
        header = "glances_"
        # Build the export module available list
        args_var = vars(locals()['args'])
        for item in os.listdir(exports_path):
            export_name = os.path.basename(item)[len(header):-3].lower()
            if (item.startswith(header) and
                    item.endswith(".py") and
                    item != (header + "export.py") and
                    item != (header + "history.py")):
                self._exports_all[export_name] = os.path.basename(item)[:-3]
                # Set the disable_<name> to False by default
                setattr(self.args,
                        'export_' + export_name,
                        getattr(self.args, 'export_' + export_name, False))

        # Aim is to check if the export module should be loaded
        for export_name in self._exports_all:
            if getattr(self.args, 'export_' + export_name, False):
                # Import the export module
                export_module = __import__(self._exports_all[export_name])
                # Add the export to the dictionary
                # The key is the module name
                # for example, the file glances_xxx.py
                # generate self._exports_list["xxx"] = ...
                self._exports[export_name] = export_module.Export(args=args,
                                                                  config=self.config)
                self._exports_all[export_name] = self._exports[export_name]

        # Log plugins list
        logger.debug("Active exports modules list: {}".format(self.getExportsList()))
        return True
1271413
function exports(_selection){
            _selection.each(function(_data){
                chartWidth = width - margin.left - margin.right;
                chartHeight = height - margin.top - margin.bottom;
                data = cleanData(cloneData(_data));

                buildScales();
                buildAxis();
                buildSVG(this);
                buildGradient();
                buildBrush();
                drawArea();
                drawAxis();
                drawBrush();
                drawHandles();
            });
        }
1225108
function export(array $data, $sheet) {
		switch ($sheet) {
		case 'creature':
			$export = new Sheets\CharacterSheetExport($this->sheetIds, $this->sheetsManager, $this->path, $this->encoder);
			break;
		case 'item':
		case 'sitem':
			$export = new Sheets\ItemSheetExport($this->sheetIds, $this->sheetsManager, $this->path, $this->encoder);
			break;
		case 'skill_tree':
			$export = new Sheets\SkilltreeSheetExport($this->sheetIds, $this->sheetsManager, $this->path, $this->encoder);
			break;
		case 'sbrick':
			$export = new Sheets\SbrickSheetExport($this->sheetIds, $this->sheetsManager, $this->path, $this->encoder);
			break;
		case 'sphrase':
			// TODO: SphraseSheetExport()
			//var_dump($data);
			return;
		default:
			throw new \RuntimeException("Unknown sheet ($sheet)");
		}

		$export->export($data, $sheet);
	}
1327473
def export_data(filename_or_fobj, data, mode="w"):
    """"""

    if filename_or_fobj is None:
        return data

    _, fobj = get_filename_and_fobj(filename_or_fobj, mode=mode)
    source = Source.from_file(filename_or_fobj, mode=mode, plugin_name=None)
    source.fobj.write(data)
    source.fobj.flush()
    return source.fobj
1334937
function saveNameToExportMap(index, def, exportsMap) {
    if (exportsMap) {
        if (def.exportAs)
            exportsMap[def.exportAs] = index;
        if (def.template)
            exportsMap[''] = index;
    }
}
286425
private function exportCollection(
        FromCollection $export,
        TemporaryFile $temporaryFile,
        string $writerType,
        int $sheetIndex
    ): Collection {
        return $export
            ->collection()
            ->chunk($this->getChunkSize($export))
            ->map(function ($rows) use ($writerType, $temporaryFile, $sheetIndex, $export) {
                if ($rows instanceof Traversable) {
                    $rows = iterator_to_array($rows);
                }

                return new AppendDataToSheet(
                    $export,
                    $temporaryFile,
                    $writerType,
                    $sheetIndex,
                    $rows
                );
            });
    }
1064600
def export_xlsx(wb, output, fn):
    
    wb.close()
    output.seek(0)
    response = HttpResponse(output.read(), content_type="application/vnd.ms-excel")
    cd = codecs.encode('attachment;filename=%s' % fn, 'utf-8')
    response['Content-Disposition'] = cd
    return response