如何打开可编辑格式的文档(.docx)?当我上传该doc文件时,它将成功在Microsoft商业帐户驱动器中查看吗?
$uri ='https://graph.microsoft.com/v1.0/me/drive/root:/roshan.docx:/content';
$headers = array( 'Content-Type: application/text', "Cache-Control: no- cache", "Pragma: no-cache", "Authorization: bearer ".$pppp );
$output = "";
$pointer = fopen($filpath, 'r+');
$stat = fstat($pointer);
$pointersize = $stat['size'];
$ch = curl_init($uri);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $pointer);
curl_setopt($ch, CURLOPT_INFILESIZE, (int) $pointersize);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
$output = curl_exec($ch);
$output = json_decode($output, true);
答案 0 :(得分:0)
Google Chrome浏览器有一个免费的扩展程序Office Editing for Docs, Sheets, and Slides。
此扩展名使您可以在云端硬盘中打开MS .docx文件并进行编辑,而无需先进行转换。
如果您要使用Graph API并以编程方式从Web应用程序打开,则可以查看此线程,其中涵盖了如何执行此操作。 How to programmatically open a file located in OneDrive using desktop Word?