getColWidths: Query or set the column widths of an Excel worksheet

View source: R/columns.R

getColWidthsR Documentation

Query or set the column widths of an Excel worksheet

Description

These two functions allow us to query and set the widths of columns in an Excel spreadsheet.

Usage

getColWidths(sh)
setColWidth(sh, width, colIds = seq(along = width), update = TRUE) 

Arguments

sh

the Worksheet-class object

width

a vector of widths for the columns.

colIds

the identifiers of the columns whose widths are being set

update

a logical value indicating whether we should update the worksheet document in the xlsx file or just make the changes in the XML file.

Value

getColWidths returns a numeric vector of widths, or NULL if none of the columns have a non-default width. Only the widths of the columns whose width has been explicitly changed are returned.

setColWidth

Author(s)

Duncan Temple Lang

Examples


 sh = workbook(system.file("SampleDocs", "Workbook1.xlsx", package = "RExcelXML"))[[1]]
 getColWidths(sh)

 dim(sh)

 setColWidth(sh, c(20, 20, 30), update = FALSE)
 getColWidths(sh)

duncantl/RExcelXML documentation built on Nov. 23, 2023, 4:21 p.m.