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 URL
s, 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.
Asked
Active
Viewed 1,109 times
0

Deduplicator
- 44,692
- 7
- 66
- 118

Jacobian
- 10,122
- 29
- 128
- 221
-
1I think the only way you'll be able to do this with PHP is using [COM](http://nl1.php.net/manual/en/book.com.php) – Mark Baker Jun 17 '15 at 10:31
-
Thanks, Mark! I will check it. Probably, it will help. – Jacobian Jun 17 '15 at 10:33
1 Answers
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....