// writeSheetStart will write the start of the Sheet's XML
773358
func (sf *StreamFile) writeSheetStart() error {
	if sf.currentSheet == nil {
		return NoCurrentSheetError
	}
	return sf.currentSheet.write(sf.sheetXmlPrefix[sf.currentSheet.index-1])
}
285658
func (f *File) SetSheetBackground(sheet, picture string) error {
	var err error
	// Check picture exists first.
	if _, err = os.Stat(picture); os.IsNotExist(err) {
		return err
	}
	ext, ok := supportImageTypes[path.Ext(picture)]
	if !ok {
		return errors.New("unsupported image extension")
	}
	file, _ := ioutil.ReadFile(picture)
	name := f.addMedia(file, ext)
	rID := f.addSheetRelationships(sheet, SourceRelationshipImage, strings.Replace(name, "xl", "..", 1), "")
	f.addSheetPicture(sheet, rID)
	f.setContentTypePartImageExtensions()
	return err
}
97109
func (sb *StreamFileBuilder) processEmptySheetXML(sf *StreamFile, path, data string) error {
	// Get the sheet index from the path
	sheetIndex, err := getSheetIndex(sf, path)
	if err != nil {
		return err
	}

	// Remove the Dimension tag. Since more rows are going to be written to the sheet, it will be wrong.
	// It is valid to for a sheet to be missing a Dimension tag, but it is not valid for it to be wrong.
	data, err = removeDimensionTag(data, sf.xlsxFile.Sheets[sheetIndex])
	if err != nil {
		return err
	}

	// Split the sheet at the end of its SheetData tag so that more rows can be added inside.
	prefix, suffix, err := splitSheetIntoPrefixAndSuffix(data)
	if err != nil {
		return err
	}
	sf.sheetXmlPrefix[sheetIndex] = prefix
	sf.sheetXmlSuffix[sheetIndex] = suffix
	return nil
}
952405
func (s *tikvStore) BeginWithStartTS(startTS uint64) (kv.Transaction, error) {
	txn, err := newTikvTxnWithStartTS(s, startTS)
	if err != nil {
		return nil, errors.Trace(err)
	}
	metrics.TiKVTxnCounter.Inc()
	return txn, nil
}
20102
func (l *lexer) resetTokenStart() {
	l.tokenStart = l.pos.byteNo
	l.tokenStartLoc = l.location()
}
679469
func (f *File) getSheetRelationshipsTargetByID(sheet, rID string) string {
	name, ok := f.sheetMap[trimSheetName(sheet)]
	if !ok {
		name = strings.ToLower(sheet) + ".xml"
	}
	var rels = "xl/worksheets/_rels/" + strings.TrimPrefix(name, "xl/worksheets/") + ".rels"
	sheetRels := f.workSheetRelsReader(rels)
	if sheetRels == nil {
		sheetRels = &xlsxWorkbookRels{}
	}
	for _, v := range sheetRels.Relationships {
		if v.ID == rID {
			return v.Target
		}
	}
	return ""
}
1183344
func WithStartAt(startAt int) userSearchF {
	return func(s userSearch) userSearch {
		s = append(s, userSearchParam{name: "startAt", value: fmt.Sprintf("%d", startAt)})
		return s
	}
}
1223550
func (s *DeleteReservationOutput) SetStart(v string) *DeleteReservationOutput {
	s.Start = &v
	return s
}
1222240
func WriteXML(writer io.Writer, v interface{}, options XML) (int, error) {
	if prefix := options.Prefix; prefix != "" {
		writer.Write([]byte(prefix))
	}

	if indent := options.Indent; indent != "" {
		result, err := xml.MarshalIndent(v, "", indent)
		if err != nil {
			return 0, err
		}
		result = append(result, newLineB...)
		return writer.Write(result)
	}

	result, err := xml.Marshal(v)
	if err != nil {
		return 0, err
	}
	return writer.Write(result)
}
1037362
func (r *Response) WriteAsXml(value interface{}) error {
	return writeXML(r, http.StatusOK, MIME_XML, value)
}
181783
func (f *File) setSheet(index int, name string) {
	var xlsx xlsxWorksheet
	xlsx.Dimension.Ref = "A1"
	xlsx.SheetViews.SheetView = append(xlsx.SheetViews.SheetView, xlsxSheetView{
		WorkbookViewID: 0,
	})
	path := "xl/worksheets/sheet" + strconv.Itoa(index) + ".xml"
	f.sheetMap[trimSheetName(name)] = path
	f.Sheet[path] = &xlsx
}
384496
func (f *File) UnprotectSheet(sheet string) error {
	xlsx, err := f.workSheetReader(sheet)
	if err != nil {
		return err
	}
	xlsx.SheetProtection = nil
	return err
}
891770
func (c *ClientupdateListCall) DateStart(dateStart int64) *ClientupdateListCall {
	c.urlParams_.Set("dateStart", fmt.Sprint(dateStart))
	return c
}
190763
func (b *BaseQueryBuilder) WriteHead(buffer *bytes.Buffer) {
	buffer.WriteString(b.head)
}
751347
func prepareSheetXML(xlsx *xlsxWorksheet, col int, row int) {
	rowCount := len(xlsx.SheetData.Row)
	if rowCount < row {
		// append missing rows
		for rowIdx := rowCount; rowIdx < row; rowIdx++ {
			xlsx.SheetData.Row = append(xlsx.SheetData.Row, xlsxRow{R: rowIdx + 1})
		}
	}
	rowData := &xlsx.SheetData.Row[row-1]
	fillColumns(rowData, col, row)
}
1932
func (c *Cmd) CmdStart() error {

	var err error

	// CmdLine check
	if c.CmdLine != "" && c.Cmd == nil {
		parseCmd, err := shellwords.Parse(c.CmdLine)
		if err != nil {
			return err
		}
		c.Cmd = exec.Command(parseCmd[0], parseCmd[1:]...)
	}
	if c.CmdLine == "" {
		c.CmdLine = strings.Join(c.Cmd.Args, " ")
	}

	var stdoutPipe, stderrPipe io.ReadCloser

	if !c.stdoutPipe {
		stdoutPipe, err = c.Cmd.StdoutPipe()
		if err != nil {
			return err
		}
	}
	if !c.stderrPipe {
		stderrPipe, err = c.Cmd.StderrPipe()
		if err != nil {
			return err
		}
	}

	// Start command.
	err = c.Cmd.Start()
	if err != nil {
		c.ExitError = err
		c.GetExitCode()
		return err
	}

	scanWrite := func(c *Cmd, r io.ReadCloser, w io.Writer, enc *encoding.Decoder, print bool) {
		if r == nil {
			return
		}
		c.Wg.Add(1)
		go func() {
			defer c.Wg.Done()
			if enc == nil {
				ScanWrite(bufio.NewScanner(r), w, print)
			} else {
				ScanWrite(bufio.NewScanner(transform.NewReader(r, enc)), w, print)
			}
		}()
	}

	scanWrite(c, stdoutPipe, &c.Stdout, c.StdoutEnc, c.StdoutPrint)
	scanWrite(c, stderrPipe, &c.Stderr, c.StderrEnc, c.StderrPrint)

	return nil
}
1049122
func WriteHeader(w io.Writer, h Header) error {
	// TODO: wrap lines when necessary

	for i := len(h.l) - 1; i >= 0; i-- {
		f := h.l[i]

		if f.b == nil {
			f.b = []byte(formatHeaderField(f.k, f.v))
		}

		if _, err := w.Write(f.b); err != nil {
			return err
		}
	}

	_, err := w.Write([]byte{'\r', '\n'})
	return err
}