Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在将HTML转换为MS Word时添加密码保护_Javascript_Jquery_Html_Ms Word_Converters - Fatal编程技术网

Javascript 在将HTML转换为MS Word时添加密码保护

Javascript 在将HTML转换为MS Word时添加密码保护,javascript,jquery,html,ms-word,converters,Javascript,Jquery,Html,Ms Word,Converters,我已经使用Jquery从HTML生成了一个MS Word文件,但是我需要为这个文件添加密码保护。在生成文件之前,是否有元数据来设置密码 参考: 代码来自库 var html = '<html xmlns:o=\'urn:schemas-microsoft-com:office:office\' xmlns:w=\'urn:schemas-microsoft-com:office:word\' xmlns=\'http://www.w3.org/TR/REC-html40\'>\n';

我已经使用Jquery从HTML生成了一个MS Word文件,但是我需要为这个文件添加密码保护。在生成文件之前,是否有元数据来设置密码

参考:

代码来自库

var html = '<html xmlns:o=\'urn:schemas-microsoft-com:office:office\' xmlns:w=\'urn:schemas-microsoft-com:office:word\' xmlns=\'http://www.w3.org/TR/REC-html40\'>\n';
            html += '<head> <meta charset=\'utf-8\'>\n';
            html += '<!--[if gte mso 9]>\n';
            html += '<xml>\n';
            html += '<w:WordDocument>\n';
            html += ( '<w:View>' + options.display + '</w:View>\n' );
            html += ('<w:Zoom>'+ options.zoom +'</w:Zoom>\n');
            html += '<w:DoNotOptimizeForBrowser/>\n';
            html += '</w:WordDocument>\n';
            html += '<o:OfficeDocumentSettings>\n';
            html += '<o:AllowPNG/>\n';
            html +='</o:OfficeDocumentSettings>\n';
            html += '</xml>\n';
            html += '<![endif]-->\n';
            html += '';
//close head
            html += '</head>\n';

//Adding page content here 

 html + = '<body><div><p>Hai</p>';

 //close body
 html += '</div></body>\n';

  //close doc
 html += '</html>\n';
var html='\n';
html+='\n';
html+='\n';
html+='';
//闭头
html+='\n';
//在此处添加页面内容
html+='Hai

'; //封闭体 html+='\n'; //结案文件 html+='\n';
googoose库中没有这样的选项

供参考

JS或Jquery不支持将密码设置为文件

但我见过使用adobe extensions为pdf设置密码


如果您确实想设置密码,那么我建议您将逻辑移到服务器端,并使用任何服务器端库来设置密码。

如何通过插件使其支持?有一个输入错误。插件不支持它。只读与操作系统有关。