Schlagwort-Archive: OLE

How to automatically apply a style to a word document

This is an „addon“ post to How to convert old word documents (.doc) into new documents (.docx) using a template. The following source code shows how to apply a style to a word document. The first procedure lists all styles within the document. The 2nd procedure set a style. Note: If you want to change the style you have to use a variable. Otherwise you will get an exception:
„Exception Class EOleException with a message “Style‘ is not a reference property‘.“
„Im Projekt WordOLEStyles.exe ist eine Exception der Klasse EOleException mit der Meldung “Style‘ ist keine Referenzeigenschaft‘ aufgetreten.“ Weiterlesen

How to convert old word documents (.doc) into new documents (.docx) using a template

The job was to convert a bunch of old word documents (.doc) into the new format .docx by using a new template file (.dotx). I have done the task by using word automation (OLE, late binding). The old files contains a header and a footer which should be replaced by the header/footer within the new template file. See the comments in the source code below. Weiterlesen