Iterate through the worksheets and set up the VML objects.
773505
def prepare_vml_objects  #:nodoc:
      comment_id     = 0
      vml_drawing_id = 0
      vml_data_id    = 1
      vml_header_id  = 0
      vml_shape_id   = 1024
      comment_files  = 0
      has_button     = false

      @worksheets.each do |sheet|
        next if !sheet.has_vml? && !sheet.has_header_vml?
        if sheet.has_vml?
          if sheet.has_comments?
            comment_files += 1
            comment_id    += 1
          end
          vml_drawing_id += 1

          sheet.prepare_vml_objects(vml_data_id, vml_shape_id,
                                    vml_drawing_id, comment_id)

          # Each VML file should start with a shape id incremented by 1024.
          vml_data_id  +=    1 * ( 1 + sheet.num_comments_block )
          vml_shape_id += 1024 * ( 1 + sheet.num_comments_block )
        end

        if sheet.has_header_vml?
          vml_header_id  += 1
          vml_drawing_id += 1
          sheet.prepare_header_vml_objects(vml_header_id, vml_drawing_id)
        end

        # Set the sheet vba_codename if it has a button and the workbook
        # has a vbaProject binary.
        unless sheet.buttons_data.empty?
          has_button = true
          if @vba_project && !sheet.vba_codename
            sheet.set_vba_name
          end
        end
      end

      add_font_format_for_cell_comments if num_comment_files > 0

      # Set the workbook vba_codename if one of the sheets has a button and
      # the workbook has a vbaProject binary.
      if has_button && @vba_project && !@vba_codename
        set_vba_name
      end
    end
804068
def itersheets(self):
        
        for ws in self.worksheets:
            # Expression with no explicit table specified will use None
            # when calling get_table, which should return the current worksheet/table
            prev_ws = self.active_worksheet
            self.active_worksheet = ws
            try:
                yield ws
            finally:
                self.active_worksheet = prev_ws
105927
def initialize_vml_shape
      pos = Axlsx::name_to_indices(ref)
      @vml_shape = VmlShape.new(:row => pos[1], :column => pos[0], :visible => @visible) do |vml|
        vml.left_column = vml.column
        vml.right_column = vml.column + 2 
        vml.top_row = vml.row
         vml.bottom_row = vml.row + 4
      end
    end
159342
protected function setUp()
	{
		$tags = [
			'TABLE' => ['template' => '<table><xsl:apply-templates/></table>'],
			'TBODY' => ['template' => '<tbody><xsl:apply-templates/></tbody>'],
			'TD'    => $this->generateCellTagConfig('td'),
			'TH'    => $this->generateCellTagConfig('th'),
			'THEAD' => ['template' => '<thead><xsl:apply-templates/></thead>'],
			'TR'    => ['template' => '<tr><xsl:apply-templates/></tr>']
		];
		foreach ($tags as $tagName => $tagConfig)
		{
			if (!isset($this->configurator->tags[$tagName]))
			{
				$this->configurator->tags->add($tagName, $tagConfig);
			}
		}
	}
779384
def push(self, vs):
        ''
        if vs:
            vs.vd = self
            if vs in self.sheets:
                self.sheets.remove(vs)
                self.sheets.insert(0, vs)
            elif not vs.loaded:
                self.sheets.insert(0, vs)
                vs.reload()
                vs.recalc()  # set up Columns
            else:
                self.sheets.insert(0, vs)

            if vs.precious and vs not in vs.vd.allSheets:
                vs.vd.allSheets[vs] = vs.name
            return vs
920338
public synchronized void setUp()
	{	
			if(initialized)
				return;

			String className = null;
			
			//Load
			Map<Object,Object> properties = settings.getProperties();
			
			String key = null;
			
			Object serviceObject = null;
			
			for(Map.Entry<Object,Object> entry : properties.entrySet())
			{
				key = String.valueOf(entry.getKey());
				
				if(key.startsWith(PROP_PREFIX))
				{
					try
					{
						className = (String)entry.getValue();
						serviceObject = ClassPath.newInstance(className);
						
						factoryMap.put(key, serviceObject);
					}
					catch (Throwable e)
					{
						throw new SetupException("CLASS:"+className+" ERROR:"+e.getMessage(),e);
					}
				}
			}
			
			initialized = true;
		}
981959
protected function setUp()
	{
		$this->collection = new NormalizedCollection;
		$this->collection->onDuplicate('replace');

		if (isset($this->configurator->tags[$this->tagName]))
		{
			return;
		}

		// Create a tag
		$tag = $this->configurator->tags->add($this->tagName);

		// Create the attribute and make it optional
		$tag->attributes->add($this->attrName)->required = false;

		// Ensure that censored content can't ever be used by other tags
		$tag->rules->ignoreTags();

		// Create a template that renders censored words either as their custom replacement or as
		// the default replacement
		$tag->template =
			'<xsl:choose>
				<xsl:when test="@' . $this->attrName . '">
					<xsl:value-of select="@' . htmlspecialchars($this->attrName) . '"/>
				</xsl:when>
				<xsl:otherwise>' . htmlspecialchars($this->defaultReplacement) . '</xsl:otherwise>
			</xsl:choose>';
	}
99258
protected function startSheet()
    {
        $this->sheetFilePointer = fopen($this->worksheetFilePath, 'w');
        $this->throwIfSheetFilePointerIsNotAvailable();

        fwrite($this->sheetFilePointer, self::SHEET_XML_FILE_HEADER);
        fwrite($this->sheetFilePointer, '<sheetData>');
    }
417560
protected function initializeResouces()
    {
        $this->resources = array();

        // Build resources array, without constructing the objects yet, for
        // lazy construction of the object tree.
        $directory = new \DirectoryIterator($this->root . $this->path);
        foreach ($directory as $fileInfo) {
            $fileName = $fileInfo->getFilename();
            if (($fileName === '.') ||
                 ($fileName === '..') ||
                 ($fileName === 'CVS'))
            {
                continue;
            }

            $resource = null;
            if ($fileInfo->isDir() === true) {
                $resource = new \Arbit\VCSWrapper\CvsCli\Directory($this->root, $this->path . $fileName . '/');
            } else {
                $resource = new \Arbit\VCSWrapper\CvsCli\File($this->root, $this->path . $fileName);
            }
            $this->resources[] = $resource;
        }
    }
186787
def _populate(self):
        
        XlsWriter._populate(self)
        for header in self.headers:
            if "sqla_xls_exporter" in header:
                header['sqla_xls_exporter']._populate()
974290
def _setup(self):
        

        cls = self.__class__
        cls._id_map = {}
        cls._name_map = {}
        for index, info in enumerate(cls._alternatives):
            if len(info) < 3:
                info = info + ({},)
                cls._alternatives[index] = info
            id_ = _build_id_tuple(info[2], info[1])
            cls._id_map[id_] = index
            cls._name_map[info[0]] = index
414185
def setup_ui(self, ):
        
        self.main_vbox = QtGui.QVBoxLayout(self)
        self.import_all_references_cb = QtGui.QCheckBox("Import references")
        self.main_vbox.addWidget(self.import_all_references_cb)
984607
def SetupVars(self):
    """"""
    # Python paths chosen to match appveyor:
    # http://www.appveyor.com/docs/installed-software#python

    self.python_dir_64 = args.python64_dir
    self.python_dir_32 = args.python32_dir

    self.virtualenv_bin64 = os.path.join(self.python_dir_64,
                                         r"Scripts\virtualenv.exe")
    self.virtualenv_bin32 = os.path.join(self.python_dir_32,
                                         r"Scripts\virtualenv.exe")

    if args.virtualenv_64bit:
      self.virtualenv64 = args.virtualenv_64bit
    else:
      self.virtualenv64 = os.path.join(args.build_dir, "python_64")
    if args.virtualenv_32bit:
      self.virtualenv32 = args.virtualenv_32bit
    else:
      self.virtualenv32 = os.path.join(args.build_dir, "python_32")

    self.grr_client_build64 = os.path.join(self.virtualenv64,
                                           r"Scripts\grr_client_build.exe")
    self.grr_client_build32 = os.path.join(self.virtualenv32,
                                           r"Scripts\grr_client_build.exe")
    self.pip64 = os.path.join(self.virtualenv64, r"Scripts\pip.exe")
    self.pip32 = os.path.join(self.virtualenv32, r"Scripts\pip.exe")

    self.virtualenv_python64 = os.path.join(self.virtualenv64,
                                            r"Scripts\python.exe")
    self.virtualenv_python32 = os.path.join(self.virtualenv32,
                                            r"Scripts\python.exe")

    self.git = r"C:\Program Files\Git\bin\git.exe"

    self.install_path = r"C:\Windows\System32\GRR"
    self.service_name = "GRR Monitor"

    self.expect_service_running = args.expect_service_running
1103470
def add_worksheet(self):
        """"""
        wsh = self.workbook.add_worksheet()
        if self.vars.fld2col_widths is not None:
            self.set_xlsx_colwidths(wsh, self.vars.fld2col_widths, self.wbfmtobj.get_prt_flds())
        return wsh
1192261
protected function setUpScripts()
    {
        Admin::script($this->script());

        foreach ($this->actions as $action) {
            $abstract = $action['abstract'];
            $abstract->setResource($this->grid->resource());

            Admin::script($abstract->script());
        }
    }
1050638
def sheets(self, index=None):
    """"""
    if self._sheets is None:
      self._sheets = [self.get_worksheet(s, i) for i, s in enumerate(self.iterate_sheets())]
    if index is None:
      return self._sheets
    else:
      return self._sheets[index]
693334
private void initWorkbook() throws Docx4JException
    {
        if(pkg == null)
            return;

        wbp = pkg.getWorkbookPart();
        sheets = ((org.xlsx4j.sml.Workbook)wbp.getJaxbElement()).getSheets().getSheet();
        wbrp = wbp.getRelationshipsPart();
        if(wbrp == null)
        {
            wbrp = new RelationshipsPart();
            wbrp.setPartName(new PartName("/xl/_rels/workbook.xml.rels"));

            //wbrp = new RelationshipsPart(new PartName("/xl/_rels/workbook.xml.rels"));
            wbp.addTargetPart(wbrp);
        }

        prp = pkg.getRelationshipsPart();
        if(prp == null)
        {
            prp = new RelationshipsPart();
            pkg.addTargetPart(prp);
        }

        PartName ssPart = new PartName("/xl/sharedStrings.xml");
        sharedStrings = (SharedStrings)pkg.getParts().get(ssPart);
        if(sharedStrings == null)
        {
            sharedStrings = new SharedStrings(ssPart);
            sharedStrings.setJaxbElement(new CTSst());
            wbp.addTargetPart(sharedStrings);
        }
        strings = sharedStrings.getJaxbElement();

        PartName stylesPart = new PartName("/xl/styles.xml");
        styles = (Styles)pkg.getParts().get(stylesPart);
        if(styles == null)
        {
            styles = new Styles(stylesPart);
            CTStylesheet styleSheet = new CTStylesheet();
            styles.setJaxbElement(styleSheet);
            wbp.addTargetPart(styles);
        }
        stylesheet = styles.getJaxbElement();

        fonts = stylesheet.getFonts();
        if(fonts == null)
        {
            fonts = new CTFonts();
            stylesheet.setFonts(fonts);
        }

        cellXfs = stylesheet.getCellXfs();
        if(cellXfs == null)
        {
            cellXfs = new CTCellXfs();
            stylesheet.setCellXfs(cellXfs);
        }

        cellStyles = stylesheet.getCellStyles();
        if(cellStyles == null)
        {
            cellStyles = new CTCellStyles();
            stylesheet.setCellStyles(cellStyles);
        }

        cellStyleXfs = stylesheet.getCellStyleXfs();
        if(cellStyleXfs == null)
        {
            cellStyleXfs = new CTCellStyleXfs();
            stylesheet.setCellStyleXfs(cellStyleXfs);
        }

        borders = stylesheet.getBorders();
        if(borders == null)
        {
            borders = new CTBorders();
            stylesheet.setBorders(borders);
        }

        fills = stylesheet.getFills();
        if(fills == null)
        {
            fills = new CTFills();
            stylesheet.setFills(fills);
        }

        if(sheets != null) 
        {
            for(int i = 0; i < sheets.size(); i++)
            {
                Sheet sheet = (Sheet)sheets.get(i);
                WorksheetPart wsp = (WorksheetPart)wbrp.getPart(sheet.getId());
                if(wsp != null)
                    worksheets.put(sheet.getName(), new XlsxWorksheet(this, wsp));
            }
        }

        //printFontInfo();
    }