Posts

Showing posts with the label com

DateSelector and Excel COM Automation Examples

Greg Bray has been using IronPython since entering (and winning) a round of the Resolver Systems spreadsheet competition . Since then he has had fun experimenting with IronPython has posted a couple of fairly complex example programs to his blog. IronPython Excel Com Automation: Pivot this! I have been playing around with IronPython recently while creating spreadsheets in Resolver One . So far I have been having a lot of fun, but I haven't really been doing anything that would be useful in a work setting. The main reason for this is because most of the spreadsheet work that I do revolves around pivot tables and Auto Filter, which are immensely helpful for visually analyzing data. I thought I might try and use Excel's COM Automation to add Pivot Charts and Auto Filter to any system with IronPython, and here is the code that I have come up with so far. ... The code should be pretty straight forward. The Reload() method is helpful for reloading the whole module when testing from ...

YAAS (Yet Another Awesome Selection)

I've nearly caught up with my backlog, but in the meantime there have been several selections full of smaller entries and snippets. Here's the first one. Batch converting Word documents to text Replace text within a Word document Two new pages on the IronPython cookbook showing how to use COM interop to automate Microsoft Word. IronPython как движок для макросов в .NET приложениях I've featured various non-English articles on IronPython before, but I think this is the first one in Russian. This article shows how to use IronPython to provide macros for C# .NET applications. The example shows Python scripts adding menu items to a notepad style app. I'm not sure of all the details, this is the best google translate could manage for part of the article: Create your tongue + interpretor to him with an opportunity. NET interoperability - non-trivial task, leave it for the enthusiasts. The code is all shown though, so it should be easy to figure it out. Tinesware - Python S...

Embedded IronPython 1 - The Simple (and Chinese) Way

This blog entry by Terence Chao is very short, and barring about two words all in Chinese. However it links to a PDF document (by the author of the blog) with examples of embedding IronPython 1 in C# and using IronPython to automate Excel. More Chinese text, but straighforward code examples: Embedded IronPython 1 - The Simple Way His Excel automation example takes command line arguments to convert Excel files into CSV files. If you are (or can read) Chinese, then you might also be interested in these entries: Dynamic Language Console: Create Python Host A simple example of the IronPython 2 hosting API, executing code from a string. This entry is mostly code, with screenshots and diagram. IronPython Tutorial This one is mainly text, but appears to be a pretty impressive IronPython tutorial. It looks like it is the start of a translation of the tutorial (by Microsoft) that comes with IronPython. You can find it on the web here . IronPython and Silverlight Another blog entry with screensh...

IronPython 2, 'with' and COM

IronPython 2 targets Python 2.5, which means that the with statement is available. This is convenient because the currently released version of IronPython 2 there is a memory leak that keeps COM objects alive after they are used. This bug is fixed in the IronPython source code control, but in the meantime a Japanese blogger has a workaround that uses 'with' and calls Marshal.ReleaseComObject - his fantastically nested example is for Excel Interop. with statement and COM His blog has some other interesting IronPython stuff, including this example of Excel 2007 interop that creates a spreadsheet from a bitmap! Excel 2007 Interop

IronPython and COM

A useful thread on the IronPython mailing list about controlling applications via COM. http://groups.google.com/group/ironpy/browse_thread/thread/f5c204d0e1ba94d5/79b04b789700d9f0#79b04b789700d9f0