Using the Code
A few coders asked me to share my developed COlezAutomation
class which is taken from here, because I developed a bit these classes. So, I was thinking of put up here a small example of how you can use these Excel classes to achieve a chart via OleAutomation
, with more than one series. Of course, you can do any other operation with this automation, such as exporting, importing, working with formulas, working with worksheets, and so on. Now I show here a charting operation.
From File->Play Excel
you can start a window top most dialog from where you can control an Excel charting (like an external application), with two kinds of charts (pie or column, 3D or not), and from "Randomize
" button you can generate several charts series.
The code is pretty simple and self explanatory, CChartFilterDlg
has a CXLEzAutomation
pointer which is a wrapper over CXLAutomation
object. So, after testing whether Excel is properly installed, CXLEzAutomation
pointer is doing remotely needed CXLAutomation
operation for charting.
Also, I put a small example of how to convert office files (doc/xls/ppt) into pdf. You can do it from File->Conver File To Pdf
item. If the conversion is done successfully, you'll get a statusbar message about that.
Enjoy it!
History
- 9th April, 2013: Initial version
- 2nd December, 2015: Source code updated
- 7th September 2021: Added 'Convert to PDF' feature