Python win32com: Excel impostato tipo di grafico a linea
-
18-09-2019 - |
Domanda
Questa macro VBA opere:
Sub Draw_Graph()
Columns("A:B").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=ActiveSheet.Range("$A:$B")
ActiveChart.ChartType = xlLine
End Sub
Questa Python (vicino) Equivalente quasi funziona:
from win32com import client
excel=client.Dispatch("Excel.Application")
excel.Visible=True
book=excel.Workbooks.Open("myfile.csv", False, True)
sheet=book.Worksheets(1)
chart=book.Charts.Add()
chart.SetSourceData(sheet.Range("$A:$B"))
chart.ChartType=client.constants.xlLine
A parte l'ultimo bit - non riesco a ottenere il tipo di grafico di essere "xlLine" (plain grafico a linee). Tutte le idee?
Soluzione
necessari per eseguire il 'makepy.py' per farlo funzionare.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow