MCPcopy
hub / github.com/qax-os/excelize / DeleteChart

Method DeleteChart

chart.go:1305–1322  ·  view source on GitHub ↗

DeleteChart provides a function to delete chart in spreadsheet by given worksheet name and cell reference.

(sheet, cell string)

Source from the content-addressed store, hash-verified

1303// DeleteChart provides a function to delete chart in spreadsheet by given
1304// worksheet name and cell reference.
1305func (f *File) DeleteChart(sheet, cell string) error {
1306 col, row, err := CellNameToCoordinates(cell)
1307 if err != nil {
1308 return err
1309 }
1310 col--
1311 row--
1312 ws, err := f.workSheetReader(sheet)
1313 if err != nil {
1314 return err
1315 }
1316 if ws.Drawing == nil {
1317 return err
1318 }
1319 drawingXML := strings.ReplaceAll(f.getSheetRelationshipsTargetByID(sheet, ws.Drawing.RID), "..", "xl")
1320 _, err = f.deleteDrawing(col, row, drawingXML, "Chart")
1321 return err
1322}
1323
1324// countCharts provides a function to get chart files count storage in the
1325// folder xl/charts.

Callers 1

TestDeleteChartFunction · 0.80

Calls 4

workSheetReaderMethod · 0.95
deleteDrawingMethod · 0.95
CellNameToCoordinatesFunction · 0.85

Tested by 1

TestDeleteChartFunction · 0.64