0
我已學習Apache POI Example on how to create a line chart。將線條標記添加到線條系列/圖表(Apache POI XSSF或Excel VBA)
它輸出一個單線圖,如Apache POI add a Series name into LineChart中的圖表。
我怎樣才能行標記添加到行?
我已學習Apache POI Example on how to create a line chart。將線條標記添加到線條系列/圖表(Apache POI XSSF或Excel VBA)
它輸出一個單線圖,如Apache POI add a Series name into LineChart中的圖表。
我怎樣才能行標記添加到行?
我使用Apache POI 3.10。到目前爲止,Apache POI XSSF無法添加行標記!所以,我用excel vba來做到這一點。
我所做的是我創建了一個帶有VBA宏的xlsm模板,以便在用戶打開xlsm文件時添加行標記。此外,我們不能POI添加VBA宏爲here提到,
Macros can not be created. The are currently no plans to support macros. However,
reading and re-writing files containing macros will safely preserve the macros.
因此,我們必須創建一個模板,並把它作爲一個POI輸入。
FileInputStream file = new FileInputStream(new File("template.xlsm"));
XSSFWorkbook workbook = new XSSFWorkbook(file);
這裏是我的VBA宏:
Sub auto_open()
Dim myChart As ChartObject
For Each myChart In Sheets("Sheet1").ChartObjects
For Each Series In myChart.Chart.SeriesCollection
Series.MarkerStyle = xlMarkerStyleSquare
Next
Next myChart
End Sub
通過使用此解決方案,我們可以添加更多的風格到POI的簡單輸出線圖。