getMsoChartSourceData: Retrieve source data matrix from the msoChart object

Description Usage Arguments Value Note Author(s) See Also Examples

Description

The function calls RDCOMClient to retrieve the source data from the embeded Worksheet of a msoChart object in the form of character matrix. It basically creates COM objects step by step and fetch Chart[["ChartData"]][[ "Workbook"]]$Worksheets(1)[["UsedRange"]][["Value"]]. You may then process the raw matrix using getCoreDataMtx.

Usage

1
2
getMsoChartSourceData(oChart, retainCoreAreaOnly = FALSE, gapWidth = 2,
  emptyString = c(NA, NaN), ...)

Arguments

oChart

msoChart object (COMIDispatch class)

retainCoreAreaOnly

Logical, only obtain the upper left core area of the matrix. Default FALSE. If TRUE, the function getCoreDataMtx will be called with preset arguments (gapWidth=2, emptyString=c(NA, NaN)).

gapWidth

numeric, width of the "gap" rows or columns. Default 2. If retainCoreAreaOnly = TRUE, then take gapWidth into effect.

emptyString

character vector, how to define the "gap". Default c(NA, NaN). If retainCoreAreaOnly = TRUE, then take emptyString into effect.

...

Other arguments.

Value

A character matrix with character rownames and colnames. Empty cells are converted to NA.

Note

Author(s)

Yiying Wang, wangy@aetna.com

See Also

getCoreDataMtx getCoreDataMtx

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
ppt <- RDCOMClient::COMCreate("Powerpoint.Application")
pres <- ppt$Presentations()$Open(<some ppt file>)
slide <- pres$Slides(2)  # the 2nd slide
shape <- slide$Shapes(3)  # the 3rd shape
if (shape[['HasChart']] == -1) {  # if the shape contains msoChart
    chart <- shape[['Chart']]
    getMsoChartSourceData(chart)
}

## End(Not run)

madlogos/aseshms documentation built on May 21, 2019, 11:03 a.m.