René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

coffies: a dll to manipulate office documents

When I wanted to use automation from c plus plus, I was very frustrated over Microsoft, because I firstly could find any material from which I could learn everything I wanted to know to master automation. yes, I tried some MFC apps but they didn't help me much because I had the feeling they were a big mess. it was probably Locate Resources to Study Automation that shed some light on the matter. after that, I started to develop Coffies, which is a dll that can be used to manipulate office documents.
Here's an example of a programm that produces
which produces LineTest.jpg
The programm code to do this is:
#define AUTOMATIONEXPORT __declspec(dllimport)
#include "../MSWord.h"
#include "../MSWDocuments.h"
#include "../MSWDocument.h"
#include "../MSWShapes.h"
#include "../MSWShape.h"

#include "math.h"

MSWDocument LineTest(MSWord& w) {
  MSWDocuments docs=w.Documents();
  MSWDocument  docForLineTest   =docs.Add();

  MSWShapes shapes = docForLineTest.Shapes();

  float xCenter=200;
  float yCenter=270;
  float radius =140;

  float step=1.34;
  for (float i=0; i<59; i+=step) {
    shapes.AddLine(xCenter+radius*sin(i), yCenter+radius*cos(i),xCenter+radius*sin(i-step),yCenter+radius*cos(i-step));
  }

  return docForLineTest;
}
This project is hosted on SourceForge Logo from where you can also download the dll and the sources. at this place I want to thank the folks at source forge for the great work they're doing.