I am using PHP to call/manipulate a Word document, using COM. One of the things I am doing is a SaveAs to text format. Because I am manipulating many Word documents, I don’t want the document to show up in the recent files list.
The VBA SaveAs function has an optional parameter to accomplish this, but I am wondering, is there a way to pass named arguments to the COM object, similar to what you can do in VBA?
For example, in Word, I could write:
ActiveDocument.SaveAs(Filename:='mynewfilename.doc', FileFormat:=2, AddToRecentFiles:=False)
Is there a way to do this in PHP using the COM object?
Since PHP does not understand the concept of named arguments (at least, not in the way that VB/A does), you will have to respect the method signature and pass the arguments in the correct order.
VB named arguments exist only to allow you pass the arguments in the wrong order, but the method still has a defined signature, and you can pass the arguments unnamed as long as they are in the correct order.
Assuming that the signature is the same as the one defined here, I would imagine this should work:
Disclaimer: I am assuming that PHP COM will handle
NULLandFALSEsensibly – this may be a foolish assumption.