1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
#' @include class_definitions.R
ChartSheet$methods(initialize = function(tabSelected = FALSE,
tabColour = character(0),
zoom = 100) {
if (length(tabColour) > 0) {
tabColour <- sprintf("<sheetPr>%s</sheetPr>", tabColour)
} else {
tabColour <- character(0)
}
if (zoom < 10) {
zoom <- 10
} else if (zoom > 400) {
zoom <- 400
}
sheetPr <<- tabColour
sheetViews <<- sprintf('<sheetViews><sheetView workbookViewId="0" zoomScale="%s" tabSelected="%s"/></sheetViews>', as.integer(zoom), as.integer(tabSelected))
pageMargins <<- '<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>'
drawing <<- '<drawing r:id=\"rId1\"/>'
hyperlinks <<- character(0)
return(invisible(0))
})
ChartSheet$methods(get_prior_sheet_data = function() {
xml <- '<chartsheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">>'
if (length(sheetPr) > 0) {
xml <- paste(xml, sheetPr, collapse = "")
}
if (length(sheetViews) > 0) {
xml <- paste(xml, sheetViews, collapse = "")
}
if (length(pageMargins) > 0) {
xml <- paste(xml, pageMargins, collapse = "")
}
if (length(drawing) > 0) {
xml <- paste(xml, drawing, collapse = "")
}
xml <- paste(xml, "</chartsheet>")
return(xml)
})
|