以下是引用吹水佬在2017-6-14 22:39:05的发言:
** 导出EXCEL图片
cPath = "C:\TEMP\"
cXLS = cPath + "test.xls"
oExcel = CREATEOBJECT("Excel.Application")
oExcel.WorkBooks.Open(cXLS)
FOR EACH oShape IN oExcel.ActiveSheet.Shapes
cJPG = cPath + JUSTSTEM(cXLS) + "_" + STRTRAN(oShape.TopLeftCell.Address,"$","") + ".jpg"
? "导出:" + cJPG
oShape.CopyPicture
oChart = oExcel.ActiveSheet.ChartObjects.Add(0,0,oShape.Width,oShape.Height).Chart
oChart.Paste
oChart.Export(cJPG, "JPG")
oChart.Parent.Delete
ENDFOR
? "导出完毕"
oExcel.ActiveWorkBook.Saved = .T.
oExcel.WorkBooks.Close
oExcel.Quit
** 导出EXCEL图片
cPath = "C:\TEMP\"
cXLS = cPath + "test.xls"
oExcel = CREATEOBJECT("Excel.Application")
oExcel.WorkBooks.Open(cXLS)
FOR EACH oShape IN oExcel.ActiveSheet.Shapes
cJPG = cPath + JUSTSTEM(cXLS) + "_" + STRTRAN(oShape.TopLeftCell.Address,"$","") + ".jpg"
? "导出:" + cJPG
oShape.CopyPicture
oChart = oExcel.ActiveSheet.ChartObjects.Add(0,0,oShape.Width,oShape.Height).Chart
oChart.Paste
oChart.Export(cJPG, "JPG")
oChart.Parent.Delete
ENDFOR
? "导出完毕"
oExcel.ActiveWorkBook.Saved = .T.
oExcel.WorkBooks.Close
oExcel.Quit
Excel 2013测试通过