<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:sl="http://schemas.openxmlformats.org/schemaLibrary/2006/main" mc:Ignorable="w14" version="1.0">
<xsl:output encoding="UTF-8" indent="no" method="xml" omit-xml-declaration="no" version="1.0"/>
<!-- Match everything all nodes and attributes -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="w:settings">
<xsl:element name="w:settings">
<xsl:for-each select="@*">
<xsl:copy/>
</xsl:for-each>
<xsl:element name="w:documentProtection">
<xsl:attribute name="w:edit">readOnly</xsl:attribute>
<xsl:attribute name="w:enforcement">1</xsl:attribute>
</xsl:element>
<xsl:copy-of select="./*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
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 ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
25 | |
17 | |
13 | |
7 | |
7 | |
7 | |
6 | |
6 | |
6 |