Prev | Current Page 326 | Next

David Berube

"Practical Reporting with Ruby and Rails"

This software can
use the Component Object Model (COM) to speak directly to your clients??™ Microsoft
Office installation, and thus create the files using Word (or Access) itself. That??™s the
approach we will take in this chapter??™s example.
nNote COM is a platform used for, among other things, interprocess communication. It lets applications
control other applications using an object-oriented interface. You can find out more about COM at http://
en.wikipedia.org/wiki/Component_object_model.
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 234
To directly import data into Word, you can use the Win32OLE library. In fact, it can
help you access any Windows COM library. Listing 12-1 shows a simple example of using
Win32OLE to create a Word document (you??™ll need Microsoft Word installed to run this
example).
Listing 12-1. Creating a Word Document with Win32OLE (create_word_document.rb)
require 'win32ole'
word_app = WIN32OLE.new('Word.Application')
word_app.visible = true
word_document = word_app.


Pages:
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
najlepsze tłumacz niemieckiego Kuchnie na wymiar Warszawa Prywatny Ośrodek Terapii uzależnień szafy