% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/xl_sheet_view.R
\name{xl_sheet_view}
\alias{xl_sheet_view}
\title{How a worksheet appears when it opens}
\usage{
xl_sheet_view(
  active = NA,
  selected = NA,
  visible = NA,
  first_tab = NA,
  selection = NULL,
  top_left = NULL,
  hide_zero = NA,
  right_to_left = NA,
  split = NULL
)
}
\arguments{
\item{active}{Logical; make this the tab Excel opens on.  At most one sheet
in a workbook may be active.}

\item{selected}{Logical; include this tab in the selected group.  The active
sheet is always selected.}

\item{visible}{Logical; `FALSE` hides the sheet's tab.  A hidden sheet cannot
be active or selected, the first sheet cannot be hidden unless another is
made active, and at least one sheet must stay visible or Excel will not
open the file.  All four rules are checked before writing.}

\item{first_tab}{Logical; make this the leftmost visible tab in the tab
strip.  Independent of which sheet is active.}

\item{selection}{The cell or range selected when the sheet opens, as an Excel
  reference (`"B2"`, `"B2:D10"`) or a `list(rows = , cols = )` spec.

  Excel also uses the order of a selection's corners to mark which cell in it
  is active; writexl does not expose that, because ranges are normalised by
  the shared range parser, which rejects an inverted range.}

\item{top_left}{The cell scrolled to the top-left of the window when the
sheet opens, as an Excel reference such as `"A5"`.}

\item{hide_zero}{Logical; display zero values as blank cells.}

\item{right_to_left}{Logical; order the columns right to left, for a sheet in
a right-to-left language.}

\item{split}{Split the sheet into scrollable panes with a visible, movable
  divider, given as the cell reference the split sits above and to the left
  of --- `"B3"` splits above row 3 and left of column B.  Mutually exclusive
  with `xl_sheet(freeze = )`, which does the same thing without the divider.

  libxlsxwriter positions a split by distance, in row-height and column-width
  units, not by row and column number.  writexl converts the cell reference
  using the sheet's actual row heights and column widths, so the split lands
  where you asked even after resizing.  Pass
  `list(vertical = , horizontal = )` to give those units directly.

  Note that libxlsxwriter derives the pane's scroll anchor back from that
  distance assuming default row heights, so on a sheet with resized rows or
  columns the divider is placed correctly but the anchor cell may be a row or
  two out.}
}
\value{
An `xl_sheet_view` object.
}
\description{
`xl_sheet_view()` collects a worksheet's tab state and opening view: which
tab is active, selected or hidden, where the sheet is scrolled and selected,
and a few display options.  Pass it as `xl_sheet(view = )`.

None of these affect the cell data.
}
\examples{
xl_sheet_view(active = TRUE, selection = "B2")
xl_sheet_view(visible = FALSE)

df <- data.frame(x = 1:3)
tmp <- write_xlsx(list(
  Summary = xl_sheet(df, view = xl_sheet_view(active = TRUE)),
  Working = xl_sheet(df, view = xl_sheet_view(visible = FALSE))
))
}
\seealso{
[xl_sheet], [xl_page_setup]

Other worksheet layout:
\code{\link{xl_colrow_spec}},
\code{\link[=xl_outline]{xl_outline()}},
\code{\link[=xl_page_setup]{xl_page_setup()}},
\code{\link[=xl_sheet]{xl_sheet()}}
}
\concept{worksheet layout}
