How to make a protected Excel file using COM class in php -
my code:
<? $file = "book1.xlsx"; $app = new com("excel.application") or die ("did not connect"); echo "loaded excel, version {$app->version}\n"; $workbooks = $app->workbooks->open($file); echo "open <br>"; $app->displayalerts = 0; $workbooks->password = '1234'; echo "pss<br>"; //$workbooks->saveas($file); $app->wookbooks->saveas($file); echo "save<br>"; $app->workbooks->close(); $app->quit; ?>
i'd make "book1.xlsx" protected excel file. didn't work.
i set php_ini file:
com.typelib_file = com.allow_dcom = true com.autoregister_typelib = true com.autoregister_casesensitive = false com.autoregister_verbose = true extension=php_com_dotnet.dll
i don't know problem is.
setting password (property) of workbook ask if try open book again. not protect it. in order that, have following method
also note calling workbooks, single workbook. important, because excel has object called workbooks, collection of open workbooks.
Comments
Post a Comment