Import the defined sheets.

@param nodeSheets The sheets node (must not be <code>null</code>).
@return The sheets filename.
547824
private static Collection<String> importSheets(Xml nodeSheets)
    {
        final Collection<Xml> children = nodeSheets.getChildren(NODE_TILE_SHEET);
        final Collection<String> sheets = new ArrayList<>(children.size());

        for (final Xml nodeSheet : children)
        {
            final String sheetFilename = nodeSheet.getText();
            sheets.add(sheetFilename);
        }

        return sheets;
    }
1179169
public String getSheetName() {
		if (this.boundSheetRecords.size() > this.sheetIndex) {
			return this.boundSheetRecords.get(this.sheetIndex > -1 ? this.sheetIndex : this.curSheetIndex).getSheetname();
		}
		return null;
	}
639562
public void importStylesheet(Stylesheet sheet) {
        if (sheet == null) {
            return;
        }
        if (importedSheets.contains(sheet.getName())) {
            return;
        }
        importedSheets.add(sheet.getName());
        for (String imp : sheet.getImports()) {
            importStylesheet(imp);
        }
        for (Mixin mix : sheet.getMixins()) {
            mixins.put(mix.getName(), mix);
        }
        for (Variable var : sheet.getVariables()) {
            if (!scope.has(var.getName()) || !var.isDefaultValue()) {
                scope.set(var.getName(), var.getValue());
            } else {
                debug("Skipping redundant variable definition: '" + var + "'");
            }
        }
        for (Section section : sheet.getSections()) {
            List<Section> stack = new ArrayList<>();
            expand(null, section, stack);
        }
    }
602938
public static DocumentPath from(List<String> elements) {
    List<String> copy = new ArrayList<>();
    copy.add(ROOT_ELEMENT);
    copy.addAll(elements);
    return new DocumentPath(copy);
  }
900773
private String getStringValue(NodeArray nodes) {
        StringBuilder stringBuilder = new StringBuilder();
        // If all we have is just a bunch of nodes and the user wants a string
        // we'll use a parent element called <string> to have a valid XML document
        stringBuilder.append("<string>");
        for (Node node : nodes) {
            stringBuilder.append(getStringValue(node));
        }
        stringBuilder.append("</string>");
        return stringBuilder.toString();
    }
403449
function visit(sheet, node) {
  var name = (node.properties || {}).className
  var scoped = {}
  var key
  var parts
  var color
  var style
  var content

  /* Always just one class. */
  name = name ? name[0].replace(/hljs-/, '') : ''

  for (key in sheet) {
    parts = key.split(' ')
    color = sheet[key]

    if (parts[0] === name) {
      if (parts.length === 1) {
        style = color
      } else {
        scoped[parts.slice(1).join(' ')] = color
      }
    } else {
      scoped[key] = color
    }
  }

  content = ''

  if ('value' in node) {
    content = node.value
  }

  if ('children' in node) {
    content = all(scoped, node.children)
  }

  if (style) {
    content = style(content)
  }

  return content
}
1145413
@Programmatic
    public Blob toExcel(final List<WorksheetContent> worksheetContents, final String fileName) {
        try {
            final File file = newExcelConverter().appendSheet(worksheetContents);
            return excelFileBlobConverter.toBlob(fileName, file);
        } catch (final IOException ex) {
            throw new ExcelService.Exception(ex);
        }
    }
1229324
public function createWorkbookFile($worksheets)
    {
        $workbookXmlFileContents = <<<EOD
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
    <sheets>
EOD;

        /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
        $escaper = \Box\Spout\Common\Escaper\XLSX::getInstance();

        /** @var Worksheet $worksheet */
        foreach ($worksheets as $worksheet) {
            $worksheetName = $worksheet->getExternalSheet()->getName();
            $worksheetId = $worksheet->getId();
            $workbookXmlFileContents .= '<sheet name="' . $escaper->escape($worksheetName) . '" sheetId="' . $worksheetId . '" r:id="rIdSheet' . $worksheetId . '"/>';
        }

        $workbookXmlFileContents .= <<<EOD
    </sheets>
</workbook>
EOD;

        $this->createFileWithContents($this->xlFolder, self::WORKBOOK_XML_FILE_NAME, $workbookXmlFileContents);

        return $this;
    }
507385
def read_cells(sheet = default_sheet)
      validate_sheet!(sheet)
      return if @cells_read[sheet]

      sheet_found = false
      doc.xpath("//*[local-name()='table']").each do |ws|
        next unless sheet == attribute(ws, 'name')

        sheet_found = true
        col         = 1
        row         = 1
        ws.children.each do |table_element|
          case table_element.name
          when 'table-column'
            @style_defaults[sheet] << table_element.attributes['default-cell-style-name']
          when 'table-row'
            if table_element.attributes['number-rows-repeated']
              skip_row = attribute(table_element, 'number-rows-repeated').to_s.to_i
              row      = row + skip_row - 1
            end
            table_element.children.each do |cell|
              skip_col   = attribute(cell, 'number-columns-repeated')
              formula    = attribute(cell, 'formula')
              value_type = attribute(cell, 'value-type')
              v          = attribute(cell, 'value')
              style_name = attribute(cell, 'style-name')
              case value_type
              when 'string'
                str_v      = ''
                # insert \n if there is more than one paragraph
                para_count = 0
                cell.children.each do |str|
                  # begin comments
                  #=begin
                  #- <table:table-cell office:value-type="string">
                  #  - <office:annotation office:display="true" draw:style-name="gr1" draw:text-style-name="P1" svg:width="1.1413in" svg:height="0.3902in" svg:x="2.0142in" svg:y="0in" draw:caption-point-x="-0.2402in" draw:caption-point-y="0.5661in">
                  #      <dc:date>2011-09-20T00:00:00</dc:date>
                  #      <text:p text:style-name="P1">Kommentar fuer B4</text:p>
                  #    </office:annotation>
                  #    <text:p>B4 (mit Kommentar)</text:p>
                  #  </table:table-cell>
                  #=end
                  if str.name == 'annotation'
                    str.children.each do |annotation|
                      next unless annotation.name == 'p'
                      # @comment ist ein Hash mit Sheet als Key (wie bei @cell)
                      # innerhalb eines Elements besteht ein Eintrag aus einem
                      # weiteren Hash mit Key [row,col] und dem eigentlichen
                      # Kommentartext als Inhalt
                      @comment[sheet]      = Hash.new unless @comment[sheet]
                      key                  = [row, col]
                      @comment[sheet][key] = annotation.text
                    end
                  end
                  # end comments
                  if str.name == 'p'
                    v          = str.content
                    str_v      += "\n" if para_count > 0
                    para_count += 1
                    if str.children.size > 1
                      str_v += children_to_string(str.children)
                    else
                      str.children.each do |child|
                        str_v += child.content #.text
                      end
                    end
                    str_v.gsub!(/&apos;/, "'") # special case not supported by unescapeHTML
                    str_v = CGI.unescapeHTML(str_v)
                  end # == 'p'
                end
              when 'time'
                cell.children.each do |str|
                  v = str.content if str.name == 'p'
                end
              when '', nil, 'date', 'percentage', 'float'
                #
              when 'boolean'
                v = attribute(cell, 'boolean-value').to_s
              end
              if skip_col
                if !v.nil? || cell.attributes['date-value']
                  0.upto(skip_col.to_i - 1) do |i|
                    set_cell_values(sheet, col, row, i, v, value_type, formula, cell, str_v, style_name)
                  end
                end
                col += (skip_col.to_i - 1)
              end # if skip
              set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)
              col += 1
            end
            row += 1
            col = 1
          end
        end
      end
      doc.xpath("//*[local-name()='automatic-styles']").each do |style|
        read_styles(style)
      end

      fail RangeError unless sheet_found

      @cells_read[sheet]    = true
      @comments_read[sheet] = true
    end
844888
@Override
    public XlsWorksheet getSheet(String name)
    {
        XlsWorksheet ret = null;
        if(workbook != null)
        {
            Sheet sheet = workbook.getSheet(name);
            if(sheet != null)
                ret = new XlsWorksheet(sheet);
        }
        else if(writableWorkbook != null)
        {
            Sheet sheet = writableWorkbook.getSheet(name);
            if(sheet != null)
                ret = new XlsWorksheet(sheet);
        }
        return ret;
    }
819449
public static TileRef imports(Xml nodeTile)
    {
        Check.notNull(nodeTile);

        final int sheet = nodeTile.readInteger(ATT_TILE_SHEET);
        final int number = nodeTile.readInteger(ATT_TILE_NUMBER);

        return new TileRef(sheet, number);
    }
1124960
public List<String> getAllSheetNames() {
    List<String> sheets = newArrayList();
    for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
      sheets.add(workbook.getSheetName(i));
    }
    return sheets;
  }
377328
async function toExcel(opts) {
  const { collection, documents, columns, stream, filename } = opts;
  const workbook = new Excel.stream.xlsx.WorkbookWriter({
    stream,
    filename,
    useStyles: true,
    useSharedStrings: true
  });

  workbook.created = new Date();
  workbook.modified = new Date();

  const sheet = workbook.addWorksheet('sheet 1');

  sheet.columns = columns.map(column => {
    const path = column.field;
    const namePath = collection.parsePath(path);

    return {
      header: column.label || namePath.pathLabel,
      key: path,
      width: 10
    };
  });

  for (const document of documents) {
    const row = {};

    for (const column of columns) {
      const path = column.field;
      const namePath = collection.parsePath(path);

      row[path] = namePath.get(document);
    }

    sheet.addRow(row).commit();
  }

  sheet.commit();

  await workbook.commit();
}
468319
def importCellsFromNet (netParams, fileName, labelList, condsList, cellNamesList, importSynMechs):
    h.initnrn()
    
    ''' '''
    if fileName.endswith('.hoc') or fileName.endswith('.tem'):
        print('Importing from .hoc network not yet supported')
        return
        # h.load_file(fileName)
        # for cellName in cellNames:
        #     cell = getattr(h, cellName) # create cell using template, passing dict with args
        #     secDic, secListDic, synMechs = getCellParams(cell)

    elif fileName.endswith('.py'):
        origDir = os.getcwd()
        filePath,fileNameOnly = os.path.split(fileName)  # split path from filename
        if filePath not in sys.path:  # add to path if not there (need to import module)
            sys.path.insert(0, filePath)
            removeFilePath = True
        else:
            removeFilePath = False
        moduleName = fileNameOnly.split('.py')[0]  # remove .py to obtain module name
        os.chdir(filePath)
        print('\nRunning network in %s to import cells into NetPyNE ...\n'%(fileName))
        from neuron import load_mechanisms
        load_mechanisms(filePath)
        tempModule = importlib.import_module(moduleName)
        modulePointer = tempModule
        if removeFilePath: sys.path.remove(filePath)
    else:
        print("File name should be either .hoc or .py file")
        return

    for label, conds, cellName in zip(labelList, condsList, cellNamesList):
        print('\nImporting %s from %s ...'%(cellName, fileName))
        exec('cell = tempModule' + '.' + cellName)
        #cell = getattr(modulePointer, cellName) # get cell object
        varList = mechVarList()
        origGlob = getGlobals(list(varList['mechs'].keys())+list(varList['pointps'].keys()))
        secs, secLists, synMechs = getCellParams(cell, varList, origGlob)
        cellRule = {'conds': conds, 'secs': secs, 'secLists': secLists}
        netParams.addCellParams(label, cellRule)
        if importSynMechs:
            for synMech in synMechs: netParams.addSynMechParams(synMech.pop('label'), synMech)
419339
def _importFromExcel(excelFilename,lastColumn = 'j',lastDataRow = 0,worksheetNumber = 1,fieldNameRow = 1,firstDataRow = 2,firstColumn = 'a')
      importFromExcel( @dbid, excelFilename, lastColumn, lastDataRow, worksheetNumber, fieldNameRow, firstDataRow, firstColumn )
   end
1026764
@Transactional
    @Override
    public void importData(ExternalStylesheetDescriptor data) {
        final String stylesheetName = data.getName();
        final String uri = data.getUri();

        IStylesheetDescriptor stylesheetDescriptor =
                this.stylesheetDescriptorDao.getStylesheetDescriptorByName(stylesheetName);
        if (stylesheetDescriptor == null) {
            stylesheetDescriptor =
                    this.stylesheetDescriptorDao.createStylesheetDescriptor(stylesheetName, uri);
        } else {
            stylesheetDescriptor.setStylesheetResource(uri);
        }

        stylesheetDescriptor.setUrlNodeSyntaxHelperName(data.getUrlSyntaxHelper());
        stylesheetDescriptor.setDescription(data.getDescription());

        final List<ExternalOutputPropertyDescriptor> extOutputProperties =
                data.getOutputProperties();
        final List<IOutputPropertyDescriptor> outputPropertyDescriptors =
                new ArrayList<IOutputPropertyDescriptor>(extOutputProperties.size());
        for (final ExternalOutputPropertyDescriptor extOutputProperty : extOutputProperties) {
            final String name = extOutputProperty.getName();
            final Scope scope = Scope.valueOf(extOutputProperty.getScope().name());
            final OutputPropertyDescriptorImpl outputPropertyDescriptor =
                    new OutputPropertyDescriptorImpl(name, scope);
            outputPropertyDescriptor.setDefaultValue(extOutputProperty.getDefaultValue());
            outputPropertyDescriptor.setDescription(extOutputProperty.getDescription());

            outputPropertyDescriptors.add(outputPropertyDescriptor);
        }
        stylesheetDescriptor.setOutputPropertyDescriptors(outputPropertyDescriptors);

        final List<ExternalStylesheetParameterDescriptor> extStylesheetParameters =
                data.getStylesheetParameters();
        final List<IStylesheetParameterDescriptor> stylesheetParameterDescriptors =
                new ArrayList<IStylesheetParameterDescriptor>(extOutputProperties.size());
        for (final ExternalStylesheetParameterDescriptor extStylesheetParameter :
                extStylesheetParameters) {
            final String name = extStylesheetParameter.getName();
            final Scope scope = Scope.valueOf(extStylesheetParameter.getScope().name());
            final StylesheetParameterDescriptorImpl stylesheetParameterDescriptor =
                    new StylesheetParameterDescriptorImpl(name, scope);
            stylesheetParameterDescriptor.setDefaultValue(extStylesheetParameter.getDefaultValue());
            stylesheetParameterDescriptor.setDescription(extStylesheetParameter.getDescription());

            stylesheetParameterDescriptors.add(stylesheetParameterDescriptor);
        }
        stylesheetDescriptor.setStylesheetParameterDescriptors(stylesheetParameterDescriptors);

        final List<ExternalLayoutAttributeDescriptor> extLayoutAttributes =
                data.getLayoutAttributes();
        final List<ILayoutAttributeDescriptor> layoutAttributeDescriptors =
                new ArrayList<ILayoutAttributeDescriptor>(extOutputProperties.size());
        for (final ExternalLayoutAttributeDescriptor extLayoutAttribute : extLayoutAttributes) {
            final String name = extLayoutAttribute.getName();
            final Scope scope = Scope.valueOf(extLayoutAttribute.getScope().name());
            final LayoutAttributeDescriptorImpl layoutAttributeDescriptor =
                    new LayoutAttributeDescriptorImpl(name, scope);
            layoutAttributeDescriptor.setDefaultValue(extLayoutAttribute.getDefaultValue());
            layoutAttributeDescriptor.setDescription(extLayoutAttribute.getDescription());
            layoutAttributeDescriptor.setTargetElementNames(
                    new LinkedHashSet<String>(extLayoutAttribute.getTargetElements()));

            layoutAttributeDescriptors.add(layoutAttributeDescriptor);
        }
        stylesheetDescriptor.setLayoutAttributeDescriptors(layoutAttributeDescriptors);

        this.stylesheetDescriptorDao.updateStylesheetDescriptor(stylesheetDescriptor);
    }
1075930
@SuppressWarnings("unchecked")
    protected void importUsers() throws CmsImportExportException {

        List<Node> userNodes;
        List<Node> groupNodes;
        List<String> userGroups;
        Element currentElement, currentGroup;
        Map<String, Object> userInfo = null;
        String name, description, flags, password, firstname, lastname, email, address, pwd, infoNode, defaultGroup;
        // try to get the import resource
        //getImportResource();
        try {
            // getAll user nodes
            userNodes = m_docXml.selectNodes("//" + A_CmsImport.N_USERDATA);
            // walk threw all groups in manifest
            for (int i = 0; i < userNodes.size(); i++) {
                currentElement = (Element)userNodes.get(i);
                name = getChildElementTextValue(currentElement, A_CmsImport.N_NAME);
                name = OpenCms.getImportExportManager().translateUser(name);
                // decode passwords using base 64 decoder
                pwd = getChildElementTextValue(currentElement, A_CmsImport.N_PASSWORD);
                password = new String(Base64.decodeBase64(pwd.trim().getBytes()));
                description = getChildElementTextValue(currentElement, A_CmsImport.N_DESCRIPTION);
                flags = getChildElementTextValue(currentElement, A_CmsImport.N_FLAGS);
                firstname = getChildElementTextValue(currentElement, A_CmsImport.N_FIRSTNAME);
                lastname = getChildElementTextValue(currentElement, A_CmsImport.N_LASTNAME);
                email = getChildElementTextValue(currentElement, A_CmsImport.N_EMAIL);
                address = getChildElementTextValue(currentElement, A_CmsImport.N_TAG_ADDRESS);
                defaultGroup = getChildElementTextValue(currentElement, A_CmsImport.N_DEFAULTGROUP);
                // get the userinfo and put it into the additional info map
                infoNode = getChildElementTextValue(currentElement, A_CmsImport.N_USERINFO);
                try {
                    // read the userinfo from the dat-file
                    byte[] value = getFileBytes(infoNode);
                    // deserialize the object
                    ByteArrayInputStream bin = new ByteArrayInputStream(value);
                    ObjectInputStream oin = new ObjectInputStream(bin);
                    userInfo = (Map<String, Object>)oin.readObject();
                } catch (IOException ioex) {
                    m_report.println(ioex);
                } catch (ClassCastException ccex) {
                    m_report.println(ccex);
                } catch (ClassNotFoundException cnfex) {
                    m_report.println(cnfex);
                }
                // in case the user info could not be parsed create a new map
                if (userInfo == null) {
                    userInfo = new HashMap<String, Object>();
                }
                // get the groups of the user and put them into the list
                groupNodes = currentElement.selectNodes("*/" + A_CmsImport.N_GROUPNAME);
                userGroups = new ArrayList<String>();
                for (int j = 0; j < groupNodes.size(); j++) {
                    currentGroup = (Element)groupNodes.get(j);
                    String userInGroup = getChildElementTextValue(currentGroup, A_CmsImport.N_NAME);
                    userInGroup = OpenCms.getImportExportManager().translateGroup(userInGroup);
                    userGroups.add(userInGroup);
                }

                if (CmsStringUtil.isNotEmpty(defaultGroup)) {
                    userInfo.put(CmsUserSettings.ADDITIONAL_INFO_DEFAULTGROUP, defaultGroup);
                }

                if (description != null) {
                    userInfo.put(CmsUserSettings.ADDITIONAL_INFO_DESCRIPTION, description);
                }
                if (address != null) {
                    userInfo.put(CmsUserSettings.ADDITIONAL_INFO_ADDRESS, address);
                }
                // import this user
                importUser(name, flags, password, firstname, lastname, email, 0, userInfo, userGroups);
            }
        } catch (CmsImportExportException e) {
            throw e;
        } catch (Exception e) {
            m_report.println(e);
            CmsMessageContainer message = Messages.get().container(Messages.ERR_IMPORTEXPORT_ERROR_IMPORTING_USERS_0);
            if (LOG.isDebugEnabled()) {
                LOG.debug(message.key(), e);
            }
            throw new CmsImportExportException(message, e);
        }
    }