0

The problem is following. I have a tool that generates .docm files. These files contain some macros. The code of macros has settings information, like URLs, etc. I want to somehow access from PHP this macros in order to make changes programmatically. This is especially necessary when the whole application with this document generator moves to another server.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Jacobian
  • 10,122
  • 29
  • 128
  • 221

1 Answers1

1

A .docm document can be more or less be considered to be a normal .zip file.

You can therefore open your document with some PHP unzipping function/library, thereby gaining access to the included file word/vbaProject.bin. You then need find or create a PHP library that can modify this vbaProject.bin file.

A quick search pointed me to this answer where the documentation for the vbaProject.bin file format is linked to: https://stackoverflow.com/a/17538985/1560865

Since the file format seems to be quite complex and there will probably be no PHP library available for it, you might want to look for an easier way though....

Community
  • 1
  • 1
Hauke P.
  • 2,695
  • 1
  • 20
  • 43