Showing posts with label Word. Show all posts
Showing posts with label Word. Show all posts

Wednesday, October 10, 2012

Word link dump

So I got the Word template engine working in a rather simple form.  It can handle exactly one set of tabular information, and text in the columns is handled the way I want to handle it (each repeated field can appear in a column with other text in the first row, and subsequent repetitions of those fields will appear alone in cells inserted below the original appearance of the field).  It's a far cry from a really mature template engine, but it does what I need it to do right now, which is pretty slick.

During all that, I collected some Word automation links - mostly forum posts by people asking for help.  But I don't want to lose them. There's a great deal of Word expertise out there and I want to understand it better.

Anyway, full documentation of the Word API is ... well, there's a whole lot of functionality in Word.  I almost think the documentation/configuration of an API structure should come in modules or something, like "core text manipulation", then add reviewing and left-to-right text if you need them.  I don't know.  It's complicated - but worth doing.

Monday, October 8, 2012

Down the Word rabbit hole

I knew there was a reason I hadn't done this Word wrapper thing.  Word is freaking huge.  Did you know that Word's "formula" mechanism includes an entire dataflow computation engine?

The sheer vastness of Word's scope is humbling.  Actually setting it forth in a coherent form?  That's a daunting task indeed.

Friday, October 5, 2012

Word and Perl

So the current Word plan is, as I say:
  • An OLE wrapper module
  • The Word (and Excel) module written on that
  • Higher-level Word tools written on that (templates, etc.)
  • A library of useful Word code - ongoing research project for "Word patterns"
To that end, a small link dump:
More on all this later: this weekend looks like time to start getting serious about the template module, and that means all this.

Monday, September 17, 2012

RTF format documentation

Voluminous and honestly not all that helpful, but this is the documentation available for RTF.

Monday, August 27, 2012

Word

Getting back into some Word and Excel automation for a programming task, and it has once again become painfully obvious that the state of automation of Office software is incredibly antiquated.

So: a real Perl OO wrapper for Word (and for Excel, but of course I know Excel in far less detail) would be a valuable thing, and could easily be factored out of my earlier Decl work with Word.  (And of course used by it, once I figure out that bug.)

This could easily be generalized to an OLE wrapper class as well that could be done in a more declarative way, but compiled.

This sort of thing would be incredibly useful in my daily life, and it's clear now that coming at it from the Decl end was a diversion.  I got excited about Decl and wanted to do all my programming there, but I should have been working directly in Perl.

Honestly - just a good documentation of the Word object model that didn't depend on Word's own help system would be a step forward.  (It's just that it's huge.)

Decisions:
  1. Call the class Win32::Word.
  2. I'm chickening out and not using Moose.  I still feel uncomfortable about the overhead, which is probably just me being old.
  3. I will, however, use the same declarative approach for OLE wrapping that Moose does, with the same syntactic sugar function trick.
Here's a neat idea I thought of, incidentally - search Github (and other sources of code) for instances of function/method/variable names (come to think of it, the constants would be a good thing to search on!) unique to the Word API.  That should net me a nice library of use cases, both for unit testing and for a nice cookbook.

Let's face it - Word automation sucks incredibly, it really does.  But it wouldn't have to.

Win32::OLE::Word should be the thin API, but I think something like Win32::OLE::Word::Sugar could include some significant simplifications and extensions to deal with common use cases (like searching for things in multiple stories).