网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

怎么将SAPDocumentBuilder的word控件设置成只读模式

这篇文章将为大家详细讲解有关怎么将SAP Document Builder的word控件设置成只读模式,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

创新互联建站专注于南岸网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供南岸营销型网站建设,南岸网站制作、南岸网页设计、南岸网站官网定制、小程序开发服务,打造南岸网络公司原创品牌,更为您提供南岸网站排名全网营销落地服务。

最近我正在从事一个客户项目,客户的一个要求是他们不希望word文档在word控件中可编辑。

这意味着工具栏中的所有按钮和菜单都应该被禁用。

怎么将SAP Document Builder的word控件设置成只读模式

image

The first idea comes to my mind is the flag “enableReadWrite“.

怎么将SAP Document Builder的word控件设置成只读模式

image

As documented in  sap help,it can fulfill my help but unfortunately it is deprecated. Regardless of this warning I have a try and found it does not work indeed.

怎么将SAP Document Builder的word控件设置成只读模式

然后我推测,如果上传的文档是只读的,那么工具栏肯定会被禁用。因此,问题变成了如何在上传过程中将文档标记为只读。

自word 2007以来,MS office的格式遵循所谓的“Open office”协议,其规范可在此处找到。

如果将文件类型扩展名从更改为。docx到。使用WinRAR压缩并打开它,您会发现该文档实际上是由多个单个文件组成的包(在SAP internal中称为文档部分)。可编辑性由文件设置控制。xml。

怎么将SAP Document Builder的word控件设置成只读模式

如果你不知道确切的语法,就用谷歌搜索。我在谷歌的解释中使用了:

现在任务非常简单,只需在文档源代码中添加必要的xml标记即可。您不需要手动解析文档源代码,因为SAP已经完成了这项工作。您可以重用标准类CL_DOCX_文档。

由于我需要在“设置”节点中插入文档保护节点,因此为此编写了一个简单的转换。魔术在第18行和第21行之间。


  
  
  
    
      
    
  
  
    
      
        
      
      
        readOnly
        1
      
      
    
  

and find a proper place to call the transformation:

 DATA: lr_element   TYPE REF TO if_wd_context_element,
         lv_file_data TYPE xstring,
         lv_ret       TYPE i,
         lx_temp      TYPE xstring,
         lv_msg       TYPE string,
         lt_parms     TYPE /ipro/tt_key_value_pair,
         ls_parm      LIKE LINE OF lt_parms.
   lr_element = me->wd_context->get_element( ).
   CHECK lr_element IS NOT INITIAL.
   lr_element->get_attribute( EXPORTING name = 'BINARY' IMPORTING value = lv_file_data ).
   DATA(lo_docx) = cl_docx_document=>load_document( lv_file_data  ).
   DATA(lo_main_part) = lo_docx->get_maindocumentpart( ).
   DATA(lo_docx_settings) = lo_main_part->get_documentsettingspart( ).
   DATA(lx_settings) = lo_docx_settings->get_data( ).
   /ipro/cl_docx_utilities=>transform( EXPORTING  iv_input_xstring    = lx_settings
                                   iv_transform_name  = '/IPRO/DOCXCC_PROTECT'
                                   it_parameters      = lt_parms
                        IMPORTING  ev_result          = lx_temp
                                   ev_ret             = lv_ret
                                   ev_message         = lv_msg  ).
   lo_docx_settings->feed_data( lx_temp ).
   DATA(lx_docx_package) = lo_docx->get_package_data( ).
   lr_element->set_attribute( EXPORTING name = 'BINARY'  value = lx_docx_package ).

after that the tag will be there in settings.xml:

怎么将SAP Document Builder的word控件设置成只读模式

image

The word control before upload document looks like below, buttons and menus available:

怎么将SAP Document Builder的word控件设置成只读模式

image

After upload, menu and button are disabled. If you try to edit the document, there will be notifications in the right pane to give you a hint that is not possible.

怎么将SAP Document Builder的word控件设置成只读模式

当然,此解决方案不适用于较低版本的MS word,如word2003。幸运的是,我的客户有足够的钱,他们已经在使用Office 2013,所以我不必为此担心。

关于怎么将SAP Document Builder的word控件设置成只读模式就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


网站标题:怎么将SAPDocumentBuilder的word控件设置成只读模式
浏览地址:http://bjjierui.cn/article/goohih.html

其他资讯