I have a question about converting a chart in a excel sheet. I try the library NPOI which is very powerful about importing data etc. But I haven't seen a method like chart.toImage or something.
Dim hssfworkbook As HSSFWorkbook = InitializeWorkbook(lblExcelPath.Text)
Dim sheet As HSSFSheet = hssfworkbook.GetSheet(txtTableName.Text)
Dim chart As HSSFChart() = HSSFChart.GetSheetCharts(sheet)
As you see I got the chart from the sheet but I can't export it. My Problem is also that the library should not use the excel application. I mean the installed office excel. The problem is that the diffrent version of excel could may a problem. Because of that Microsoft.Office.Interop
library is not a solution. I found the aspose library which cost a bit. So first of all I try to search a free cost library for this little problem.
Update:
A possible solution could be convert the excel sheet in html and extract the image of the chart as a image. When i open the excel file and save it as html it works. Does anyone test a library which convert Excel to HTML and have success with converting the chart in it?
I hope everyone understands me, my english is bad ):
Thank you in advance
Check out the Chart.Export method in Excel's object model. It's present and works the same in Excel 97 through Excel 2013. Syntax is like:
Chart.Export Filename, Filter
or
ActiveChart.Export "C:\\users\\Fred\\Documents\\Charts\\MyExcelChart.png", "PNG"
Use "PNG" for charts, not "JPG".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.