├── CEX └── ABAP2DOCX │ ├── CLAS │ └── CEX │ │ ├── CL_WORD.slnk │ │ └── CL_WORD_WRITER.slnk │ ├── INTF │ └── CEX │ │ └── IF_WORD_BOOK_PROPERTIES.slnk │ └── PROG │ └── CEX │ ├── DEMO_WORD1.slnk │ └── DOCX_ZAKE_SVN.slnk ├── LICENSE ├── README.md └── build └── abap2docx_Daily.nugg.zip /CEX/ABAP2DOCX/CLAS/CEX/CL_WORD.slnk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | *"* use this source file for the definition and implementation of 5 | *"* local helper classes, interface definitions and type 6 | *"* declarations 7 | *"* use this source file for any type of declarations (class 8 | *"* definitions, interfaces or type declarations) you need for 9 | *"* components in the private section 10 | *"* use this source file for any macro definitions you need 11 | *"* in the implementation part of the class 12 | 13 | 14 | method /CEX/IF_WORD_BOOK_PROPERTIES~INITIALIZE. 15 | endmethod. 16 | 17 | 18 | -------------------------------------------------------------------------------- /CEX/ABAP2DOCX/CLAS/CEX/CL_WORD_WRITER.slnk: -------------------------------------------------------------------------------- 1 | 2 | 3 | *"* local class implementation for public class 4 | *"* use this source file for the implementation part of 5 | *"* local helper classes 6 | *"* use this source file for any type declarations (class 7 | *"* definitions, interfaces or data types) you need for method 8 | *"* implementation or private method's signature 9 | *"* use this source file for any macro definitions you need 10 | *"* in the implementation part of the class 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | METHOD CREATE. 27 | 28 | DATA: lo_zip TYPE REF TO cl_abap_zip. 29 | 30 | DATA: lv_content TYPE xstring. 31 | 32 | ep_ooxml_document = super->create( ). 33 | 34 | * Gets basic ZIP file and add specific elements 35 | CREATE OBJECT lo_zip. 36 | lo_zip->load( ep_ooxml_document ). 37 | 38 | ********************************************************************** 39 | * STEP 1: Add word/_rels/document.xml.rels to zip 40 | lv_content = me->create_word_relationships( ). 41 | lo_zip->add( name = me->c_word_relationships 42 | content = lv_content ). 43 | 44 | ********************************************************************** 45 | * STEP 2: Add word/theme/theme1.xml to zip 46 | lv_content = me->create_word_theme( ). 47 | lo_zip->add( name = me->c_word_theme 48 | content = lv_content ). 49 | 50 | ********************************************************************** 51 | * STEP 3: Add word/document.xml to zip 52 | lv_content = me->create_word_document( ). 53 | lo_zip->add( name = me->c_word_document 54 | content = lv_content ). 55 | 56 | ********************************************************************** 57 | * STEP 4: Add word/styles.xml to zip 58 | lv_content = me->create_word_styles( ). 59 | lo_zip->add( name = me->c_word_styles 60 | content = lv_content ). 61 | 62 | ********************************************************************** 63 | * STEP 5: Add word/_rels/document.xml.rels to zip 64 | lv_content = me->create_word_fonttable( ). 65 | lo_zip->add( name = me->c_word_fonttable 66 | content = lv_content ). 67 | 68 | ********************************************************************** 69 | * STEP 6: Add word/theme/theme1.xml to zip 70 | lv_content = me->create_word_settings( ). 71 | lo_zip->add( name = me->c_word_settings 72 | content = lv_content ). 73 | 74 | ********************************************************************** 75 | * STEP 7: Add word/document.xml to zip 76 | lv_content = me->create_word_styleswitheffects( ). 77 | lo_zip->add( name = me->c_word_styleswitheffects 78 | content = lv_content ). 79 | 80 | ********************************************************************** 81 | * STEP 8: Add word/styles.xml to zip 82 | lv_content = me->create_word_websettings( ). 83 | lo_zip->add( name = me->c_word_websettings 84 | content = lv_content ). 85 | 86 | ep_ooxml_document = lo_zip->save( ). 87 | 88 | ENDMETHOD. 89 | 90 | 91 | METHOD create_content_types. 92 | 93 | DATA: lc_xml_node_override TYPE string VALUE 'Override', 94 | " Node attributes 95 | lc_xml_attr_partname TYPE string VALUE 'PartName', 96 | lc_xml_attr_contenttype TYPE string VALUE 'ContentType', 97 | " Node partnumber 98 | lc_xml_node_document_pn TYPE string VALUE '/word/document.xml', 99 | lc_xml_node_styles_pn TYPE string VALUE '/word/styles.xml', 100 | lc_xml_node_stylesweff_pn TYPE string VALUE '/word/stylesWithEffects.xml', 101 | lc_xml_node_settings_pn TYPE string VALUE '/word/settings.xml', 102 | lc_xml_node_websettings_pn TYPE string VALUE '/word/webSettings.xml', 103 | lc_xml_node_fonttable_pn TYPE string VALUE '/word/fontTable.xml', 104 | lc_xml_node_theme_pn TYPE string VALUE '/word/theme/theme1.xml', 105 | lc_xml_node_core_pn TYPE string VALUE '/docProps/core.xml', 106 | lc_xml_node_app_pn TYPE string VALUE '/docProps/app.xml', 107 | " Node contentType 108 | lc_xml_node_document_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml', 109 | lc_xml_node_styles_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml', 110 | lc_xml_node_stylesweff_ct TYPE string VALUE 'application/vnd.ms-word.stylesWithEffects+xml', 111 | lc_xml_node_settings_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml', 112 | lc_xml_node_websettings_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml', 113 | lc_xml_node_fonttable_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml', 114 | lc_xml_node_theme_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.theme+xml', 115 | lc_xml_node_core_ct TYPE string VALUE 'application/vnd.openxmlformats-package.core-properties+xml', 116 | lc_xml_node_app_ct TYPE string VALUE 'application/vnd.openxmlformats-officedocument.extended-properties+xml'. 117 | 118 | DATA: lo_word TYPE REF TO /cex/cl_word, 119 | lo_ixml TYPE REF TO if_ixml, 120 | lo_document TYPE REF TO if_ixml_document, 121 | lo_document_xml TYPE REF TO cl_xml_document, 122 | lo_element_root TYPE REF TO if_ixml_node, 123 | lo_element TYPE REF TO if_ixml_element, 124 | lo_node TYPE REF TO if_ixml_node, 125 | lo_encoding TYPE REF TO if_ixml_encoding, 126 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 127 | lo_ostream TYPE REF TO if_ixml_ostream, 128 | lo_renderer TYPE REF TO if_ixml_renderer. 129 | 130 | DATA: lv_subrc TYPE sysubrc, 131 | lv_value TYPE string. 132 | 133 | lo_word ?= me->ooxml_doc. 134 | 135 | ********************************************************************** 136 | * STEP 1: Create standard relationship 137 | ep_content = super->create_content_types( ). 138 | 139 | ********************************************************************** 140 | * STEP 2: modify XML adding Word specific attributes 141 | 142 | CREATE OBJECT lo_document_xml. 143 | lv_subrc = lo_document_xml->parse_xstring( ep_content ). 144 | 145 | lo_document ?= lo_document_xml->m_document. 146 | lo_element_root = lo_document->if_ixml_node~get_first_child( ). 147 | 148 | " Document node 149 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 150 | parent = lo_document ). 151 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 152 | value = lc_xml_node_document_pn ). 153 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 154 | value = lc_xml_node_document_ct ). 155 | lo_element_root->append_child( new_child = lo_element ). 156 | 157 | " Styles node 158 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 159 | parent = lo_document ). 160 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 161 | value = lc_xml_node_styles_pn ). 162 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 163 | value = lc_xml_node_styles_ct ). 164 | lo_element_root->append_child( new_child = lo_element ). 165 | 166 | " Styles with effects node 167 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 168 | parent = lo_document ). 169 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 170 | value = lc_xml_node_stylesweff_pn ). 171 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 172 | value = lc_xml_node_stylesweff_ct ). 173 | lo_element_root->append_child( new_child = lo_element ). 174 | 175 | " Settings node 176 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 177 | parent = lo_document ). 178 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 179 | value = lc_xml_node_settings_pn ). 180 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 181 | value = lc_xml_node_settings_ct ). 182 | lo_element_root->append_child( new_child = lo_element ). 183 | 184 | " Web settings node 185 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 186 | parent = lo_document ). 187 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 188 | value = lc_xml_node_websettings_pn ). 189 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 190 | value = lc_xml_node_websettings_ct ). 191 | lo_element_root->append_child( new_child = lo_element ). 192 | 193 | " Font Table node 194 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 195 | parent = lo_document ). 196 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 197 | value = lc_xml_node_fonttable_pn ). 198 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 199 | value = lc_xml_node_fonttable_ct ). 200 | lo_element_root->append_child( new_child = lo_element ). 201 | 202 | " Theme node 203 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 204 | parent = lo_document ). 205 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 206 | value = lc_xml_node_theme_pn ). 207 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 208 | value = lc_xml_node_theme_ct ). 209 | lo_element_root->append_child( new_child = lo_element ). 210 | 211 | " Core node 212 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 213 | parent = lo_document ). 214 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 215 | value = lc_xml_node_core_pn ). 216 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 217 | value = lc_xml_node_core_ct ). 218 | lo_element_root->append_child( new_child = lo_element ). 219 | 220 | " App node 221 | lo_element = lo_document->create_simple_element( name = lc_xml_node_override 222 | parent = lo_document ). 223 | lo_element->set_attribute_ns( name = lc_xml_attr_partname 224 | value = lc_xml_node_app_pn ). 225 | lo_element->set_attribute_ns( name = lc_xml_attr_contenttype 226 | value = lc_xml_node_app_ct ). 227 | lo_element_root->append_child( new_child = lo_element ). 228 | 229 | 230 | ********************************************************************** 231 | * STEP x: Create xstring stream 232 | CLEAR ep_content. 233 | lo_ixml = cl_ixml=>create( ). 234 | lo_streamfactory = lo_ixml->create_stream_factory( ). 235 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 236 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 237 | lo_renderer->render( ). 238 | 239 | ENDMETHOD. 240 | 241 | 242 | METHOD create_docprops_app. 243 | 244 | DATA: lc_xml_node_characters TYPE string VALUE 'Characters', 245 | lc_xml_node_charactersspaces TYPE string VALUE 'CharactersWithSpaces', 246 | lc_xml_node_lines TYPE string VALUE 'Lines', 247 | lc_xml_node_pages TYPE string VALUE 'Pages', 248 | lc_xml_node_paragraphs TYPE string VALUE 'Paragraphs', 249 | lc_xml_node_template TYPE string VALUE 'Template', 250 | lc_xml_node_totaltime TYPE string VALUE 'TotalTime', 251 | lc_xml_node_words TYPE string VALUE 'Words'. 252 | 253 | DATA: lo_word TYPE REF TO /cex/cl_word, 254 | lo_ixml TYPE REF TO if_ixml, 255 | lo_document TYPE REF TO if_ixml_document, 256 | lo_document_xml TYPE REF TO cl_xml_document, 257 | lo_element_root TYPE REF TO if_ixml_node, 258 | lo_element TYPE REF TO if_ixml_element, 259 | lo_node TYPE REF TO if_ixml_node, 260 | lo_encoding TYPE REF TO if_ixml_encoding, 261 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 262 | lo_ostream TYPE REF TO if_ixml_ostream, 263 | lo_renderer TYPE REF TO if_ixml_renderer. 264 | 265 | DATA: lv_subrc TYPE sysubrc, 266 | lv_value TYPE string. 267 | 268 | lo_word ?= me->ooxml_doc. 269 | 270 | ********************************************************************** 271 | * STEP 1: Create standard relationship 272 | ep_content = super->create_docprops_app( ). 273 | 274 | ********************************************************************** 275 | * STEP 2: modify XML adding Word specific attributes 276 | 277 | CREATE OBJECT lo_document_xml. 278 | lv_subrc = lo_document_xml->parse_xstring( ep_content ). 279 | 280 | lo_document ?= lo_document_xml->m_document. 281 | lo_element_root = lo_document->if_ixml_node~get_first_child( ). 282 | 283 | " Characters 284 | lo_element = lo_document->create_simple_element( name = lc_xml_node_characters 285 | parent = lo_document ). 286 | lv_value = lo_word->/cex/if_word_book_properties~characters. 287 | CONDENSE lv_value. 288 | lo_element->set_value( value = lv_value ). 289 | lo_element_root->append_child( new_child = lo_element ). 290 | 291 | " CharactersWithSpaces 292 | lo_element = lo_document->create_simple_element( name = lc_xml_node_charactersspaces 293 | parent = lo_document ). 294 | lv_value = lo_word->/cex/if_word_book_properties~characterswithspaces. 295 | CONDENSE lv_value. 296 | lo_element->set_value( value = lv_value ). 297 | lo_element_root->append_child( new_child = lo_element ). 298 | 299 | " Lines 300 | lo_element = lo_document->create_simple_element( name = lc_xml_node_lines 301 | parent = lo_document ). 302 | lv_value = lo_word->/cex/if_word_book_properties~lines. 303 | CONDENSE lv_value. 304 | lo_element->set_value( value = lv_value ). 305 | lo_element_root->append_child( new_child = lo_element ). 306 | 307 | " Pages 308 | lo_element = lo_document->create_simple_element( name = lc_xml_node_pages 309 | parent = lo_document ). 310 | lv_value = lo_word->/cex/if_word_book_properties~pages. 311 | CONDENSE lv_value. 312 | lo_element->set_value( value = lv_value ). 313 | lo_element_root->append_child( new_child = lo_element ). 314 | 315 | " Paragraphs 316 | lo_element = lo_document->create_simple_element( name = lc_xml_node_paragraphs 317 | parent = lo_document ). 318 | lv_value = lo_word->/cex/if_word_book_properties~paragraphs. 319 | CONDENSE lv_value. 320 | lo_element->set_value( value = lv_value ). 321 | lo_element_root->append_child( new_child = lo_element ). 322 | 323 | " Template 324 | lo_element = lo_document->create_simple_element( name = lc_xml_node_template 325 | parent = lo_document ). 326 | lv_value = lo_word->/cex/if_word_book_properties~template. 327 | lo_element->set_value( value = lv_value ). 328 | lo_element_root->append_child( new_child = lo_element ). 329 | 330 | " TotalTime 331 | lo_element = lo_document->create_simple_element( name = lc_xml_node_totaltime 332 | parent = lo_document ). 333 | lv_value = lo_word->/cex/if_word_book_properties~totaltime. 334 | CONDENSE lv_value. 335 | lo_element->set_value( value = lv_value ). 336 | lo_element_root->append_child( new_child = lo_element ). 337 | 338 | " Words 339 | lo_element = lo_document->create_simple_element( name = lc_xml_node_words 340 | parent = lo_document ). 341 | lv_value = lo_word->/cex/if_word_book_properties~words. 342 | CONDENSE lv_value. 343 | lo_element->set_value( value = lv_value ). 344 | lo_element_root->append_child( new_child = lo_element ). 345 | 346 | ********************************************************************** 347 | * STEP x: Create xstring stream 348 | CLEAR ep_content. 349 | lo_ixml = cl_ixml=>create( ). 350 | lo_streamfactory = lo_ixml->create_stream_factory( ). 351 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 352 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 353 | lo_renderer->render( ). 354 | 355 | ENDMETHOD. 356 | 357 | 358 | METHOD create_relationships. 359 | 360 | DATA: lc_xml_node_relationship TYPE string VALUE 'Relationship', 361 | " Node attributes 362 | lc_xml_attr_id TYPE string VALUE 'Id', 363 | lc_xml_attr_type TYPE string VALUE 'Type', 364 | lc_xml_attr_target TYPE string VALUE 'Target', 365 | " Node id 366 | lc_xml_node_rid1_id TYPE string VALUE 'rId1', 367 | " Node type 368 | lc_xml_node_rid1_tp TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument', 369 | " Node target 370 | lc_xml_node_rid1_tg TYPE string VALUE 'word/document.xml'. 371 | 372 | DATA: lo_word TYPE REF TO /cex/cl_word, 373 | lo_ixml TYPE REF TO if_ixml, 374 | lo_document TYPE REF TO if_ixml_document, 375 | lo_document_xml TYPE REF TO cl_xml_document, 376 | lo_element_root TYPE REF TO if_ixml_node, 377 | lo_element TYPE REF TO if_ixml_element, 378 | lo_node TYPE REF TO if_ixml_node, 379 | lo_encoding TYPE REF TO if_ixml_encoding, 380 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 381 | lo_ostream TYPE REF TO if_ixml_ostream, 382 | lo_renderer TYPE REF TO if_ixml_renderer. 383 | 384 | DATA: lv_subrc TYPE sysubrc, 385 | lv_value TYPE string. 386 | 387 | lo_word ?= me->ooxml_doc. 388 | 389 | ********************************************************************** 390 | * STEP 1: Create standard relationship 391 | ep_content = super->create_relationships( ). 392 | 393 | ********************************************************************** 394 | * STEP 2: modify XML adding Word specific attributes 395 | 396 | CREATE OBJECT lo_document_xml. 397 | lv_subrc = lo_document_xml->parse_xstring( ep_content ). 398 | 399 | lo_document ?= lo_document_xml->m_document. 400 | lo_element_root = lo_document->if_ixml_node~get_first_child( ). 401 | 402 | " rels node 403 | lo_element = lo_document->create_simple_element( name = lc_xml_node_relationship 404 | parent = lo_document ). 405 | lo_element->set_attribute_ns( name = lc_xml_attr_id 406 | value = lc_xml_node_rid1_id ). 407 | lo_element->set_attribute_ns( name = lc_xml_attr_type 408 | value = lc_xml_node_rid1_tp ). 409 | lo_element->set_attribute_ns( name = lc_xml_attr_target 410 | value = lc_xml_node_rid1_tg ). 411 | lo_element_root->append_child( new_child = lo_element ). 412 | 413 | ********************************************************************** 414 | * STEP 3: Create xstring stream 415 | CLEAR ep_content. 416 | lo_ixml = cl_ixml=>create( ). 417 | lo_streamfactory = lo_ixml->create_stream_factory( ). 418 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 419 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 420 | lo_renderer->render( ). 421 | 422 | 423 | 424 | 425 | ENDMETHOD. 426 | 427 | 428 | 429 | METHOD create_word_document. 430 | 431 | 432 | DATA: lo_word TYPE REF TO /cex/cl_word, 433 | lo_ixml TYPE REF TO if_ixml, 434 | lo_document TYPE REF TO if_ixml_document, 435 | lo_element_root TYPE REF TO if_ixml_element, 436 | lo_element_body TYPE REF TO if_ixml_element, 437 | lo_element_p TYPE REF TO if_ixml_element, 438 | lo_element_sectpr TYPE REF TO if_ixml_element, 439 | lo_element_pgsz TYPE REF TO if_ixml_element, 440 | lo_element_pgmar TYPE REF TO if_ixml_element, 441 | lo_element_cols TYPE REF TO if_ixml_element, 442 | lo_element_docgrid TYPE REF TO if_ixml_element, 443 | lo_encoding TYPE REF TO if_ixml_encoding, 444 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 445 | lo_ostream TYPE REF TO if_ixml_ostream, 446 | lo_renderer TYPE REF TO if_ixml_renderer. 447 | 448 | DATA: lc_xml_node_document TYPE string VALUE 'document', 449 | lc_xml_node_body TYPE string VALUE 'body', 450 | lc_xml_node_p TYPE string VALUE 'p', 451 | lc_xml_node_sectpr TYPE string VALUE 'sectPr', 452 | lc_xml_node_pgsz TYPE string VALUE 'pgSz', 453 | lc_xml_node_pgmar TYPE string VALUE 'pgMar', 454 | lc_xml_node_cols TYPE string VALUE 'cols', 455 | lc_xml_node_docgrid TYPE string VALUE 'docGrid', 456 | " Node attributes 457 | lc_xml_attr_rsidr TYPE string VALUE 'rsidR', 458 | lc_xml_attr_rsidrdefault TYPE string VALUE 'rsidRDefault', 459 | lc_xml_attr_rsidsect TYPE string VALUE 'rsidSect', 460 | lc_xml_attr_w TYPE string VALUE 'w', 461 | lc_xml_attr_h TYPE string VALUE 'h', 462 | lc_xml_attr_top TYPE string VALUE 'top', 463 | lc_xml_attr_right TYPE string VALUE 'right', 464 | lc_xml_attr_bottom TYPE string VALUE 'bottom', 465 | lc_xml_attr_left TYPE string VALUE 'left', 466 | lc_xml_attr_header TYPE string VALUE 'header', 467 | lc_xml_attr_footer TYPE string VALUE 'footer', 468 | lc_xml_attr_gutter TYPE string VALUE 'gutter', 469 | lc_xml_attr_space TYPE string VALUE 'space', 470 | lc_xml_attr_linepitch TYPE string VALUE 'linePitch', 471 | " Namespace prefix 472 | lc_ve_ns TYPE string VALUE 've', 473 | lc_o_ns TYPE string VALUE 'o', 474 | lc_r_ns TYPE string VALUE 'r', 475 | lc_m_ns TYPE string VALUE 'm', 476 | lc_v_ns TYPE string VALUE 'v', 477 | lc_wp_ns TYPE string VALUE 'wp', 478 | lc_w10_ns TYPE string VALUE 'w10', 479 | lc_w_ns TYPE string VALUE 'w', 480 | lc_wne_ns TYPE string VALUE 'wne', 481 | " Node namespace 482 | lc_xml_node_ve_ns TYPE string VALUE 'http://schemas.openxmlformats.org/markup-compatibility/2006', 483 | lc_xml_node_o_ns TYPE string VALUE 'urn:schemas-microsoft-com:office:office', 484 | lc_xml_node_r_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', 485 | lc_xml_node_m_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/math', 486 | lc_xml_node_v_ns TYPE string VALUE 'urn:schemas-microsoft-com:vml', 487 | lc_xml_node_wp_ns TYPE string VALUE 'http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing', 488 | lc_xml_node_w10_ns TYPE string VALUE 'urn:schemas-microsoft-com:office:word', 489 | lc_xml_node_w_ns TYPE string VALUE 'http://schemas.openxmlformats.org/wordprocessingml/2006/main', 490 | lc_xml_node_wne_ns TYPE string VALUE 'http://schemas.microsoft.com/office/word/2006/wordml'. 491 | 492 | lo_word ?= me->ooxml_doc. 493 | 494 | ********************************************************************** 495 | * STEP 1: Create word/document.xml into the root of the ZIP 496 | lo_ixml = cl_ixml=>create( ). 497 | 498 | ********************************************************************** 499 | * STEP 2: Set document attributes 500 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 501 | character_set = 'utf-8' ). 502 | lo_document = lo_ixml->create_document( ). 503 | lo_document->set_encoding( lo_encoding ). 504 | lo_document->set_standalone( abap_true ). 505 | 506 | *********************************************************************** 507 | * STEP 3: Create main node relationships 508 | lo_element_root = lo_document->create_simple_element( name = lc_xml_node_document 509 | parent = lo_document ). 510 | lo_element_root->set_attribute_ns( name = 'xmlns:ve' 511 | value = lc_xml_node_ve_ns ). 512 | lo_element_root->set_attribute_ns( name = 'xmlns:o' 513 | value = lc_xml_node_o_ns ). 514 | lo_element_root->set_attribute_ns( name = 'xmlns:r' 515 | value = lc_xml_node_r_ns ). 516 | lo_element_root->set_attribute_ns( name = 'xmlns:m' 517 | value = lc_xml_node_m_ns ). 518 | lo_element_root->set_attribute_ns( name = 'xmlns:v' 519 | value = lc_xml_node_v_ns ). 520 | lo_element_root->set_attribute_ns( name = 'xmlns:wp' 521 | value = lc_xml_node_wp_ns ). 522 | lo_element_root->set_attribute_ns( name = 'xmlns:w10' 523 | value = lc_xml_node_w10_ns ). 524 | lo_element_root->set_attribute_ns( name = 'xmlns:w' 525 | value = lc_xml_node_w_ns ). 526 | lo_element_root->set_attribute_ns( name = 'xmlns:wne' 527 | value = lc_xml_node_wne_ns ). 528 | 529 | ********************************************************************** 530 | * STEP 4: Create subnodes 531 | " body 532 | lo_element_body = lo_document->create_simple_element_ns( name = lc_xml_node_body 533 | prefix = lc_w_ns 534 | parent = lo_document ). 535 | " p 536 | lo_element_p = lo_document->create_simple_element_ns( name = lc_xml_node_p 537 | prefix = lc_w_ns 538 | parent = lo_document ). 539 | 540 | lo_element_p->set_attribute_ns( name = lc_xml_attr_rsidr 541 | prefix = lc_w_ns 542 | value = '00C17603' ). 543 | 544 | lo_element_p->set_attribute_ns( name = lc_xml_attr_rsidrdefault 545 | prefix = lc_w_ns 546 | value = '00C17603' ). 547 | 548 | " sectPr 549 | lo_element_sectpr = lo_document->create_simple_element_ns( name = lc_xml_node_sectpr 550 | prefix = lc_w_ns 551 | parent = lo_document ). 552 | 553 | lo_element_p->set_attribute_ns( name = lc_xml_attr_rsidr 554 | prefix = lc_w_ns 555 | value = '00C17603' ). 556 | 557 | lo_element_p->set_attribute_ns( name = lc_xml_attr_rsidsect 558 | prefix = lc_w_ns 559 | value = '00C17603' ). 560 | 561 | " pgSz 562 | lo_element_pgsz = lo_document->create_simple_element_ns( name = lc_xml_node_pgsz 563 | prefix = lc_w_ns 564 | parent = lo_document ). 565 | 566 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_w 567 | prefix = lc_w_ns 568 | value = '11906' ). 569 | 570 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_h 571 | prefix = lc_w_ns 572 | value = '16838' ). 573 | 574 | " pgMar 575 | lo_element_pgmar = lo_document->create_simple_element_ns( name = lc_xml_node_pgmar 576 | prefix = lc_w_ns 577 | parent = lo_document ). 578 | 579 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_top 580 | prefix = lc_w_ns 581 | value = '1417' ). 582 | 583 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_right 584 | prefix = lc_w_ns 585 | value = '1134' ). 586 | 587 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_bottom 588 | prefix = lc_w_ns 589 | value = '1134' ). 590 | 591 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_left 592 | prefix = lc_w_ns 593 | value = '1134' ). 594 | 595 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_header 596 | prefix = lc_w_ns 597 | value = '708' ). 598 | 599 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_footer 600 | prefix = lc_w_ns 601 | value = '708' ). 602 | 603 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_gutter 604 | prefix = lc_w_ns 605 | value = '0' ). 606 | 607 | " cols 608 | lo_element_cols = lo_document->create_simple_element_ns( name = lc_xml_node_cols 609 | prefix = lc_w_ns 610 | parent = lo_document ). 611 | 612 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_space 613 | prefix = lc_w_ns 614 | value = '708' ). 615 | 616 | " docGrid 617 | lo_element_docgrid = lo_document->create_simple_element_ns( name = lc_xml_node_docgrid 618 | prefix = lc_w_ns 619 | parent = lo_document ). 620 | 621 | lo_element_pgsz->set_attribute_ns( name = lc_xml_attr_linepitch 622 | prefix = lc_w_ns 623 | value = '360' ). 624 | 625 | 626 | lo_element_sectpr->append_child( new_child = lo_element_pgsz ). " pgSz node 627 | lo_element_sectpr->append_child( new_child = lo_element_pgmar ). " pgMar node 628 | lo_element_sectpr->append_child( new_child = lo_element_cols ). " cols node 629 | lo_element_sectpr->append_child( new_child = lo_element_docgrid ). " docGrid node 630 | 631 | lo_element_p->append_child( new_child = lo_element_sectpr ). " p node 632 | 633 | lo_element_body->append_child( new_child = lo_element_p ). " body node 634 | 635 | lo_element_root->append_child( new_child = lo_element_body ). " TitlesOfParts 636 | 637 | ********************************************************************** 638 | * STEP 5: Create xstring stream 639 | CLEAR ep_content. 640 | lo_ixml = cl_ixml=>create( ). 641 | lo_streamfactory = lo_ixml->create_stream_factory( ). 642 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 643 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 644 | lo_renderer->render( ). 645 | 646 | ENDMETHOD. 647 | 648 | 649 | 650 | method CREATE_WORD_FONTTABLE. 651 | 652 | DATA: lo_word TYPE REF TO /cex/cl_word, 653 | lo_ixml TYPE REF TO if_ixml, 654 | lo_document TYPE REF TO if_ixml_document, 655 | lo_document_xml TYPE REF TO cl_xml_document, 656 | lo_element_root TYPE REF TO if_ixml_node, 657 | lo_element TYPE REF TO if_ixml_element, 658 | lo_node TYPE REF TO if_ixml_node, 659 | lo_encoding TYPE REF TO if_ixml_encoding, 660 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 661 | lo_ostream TYPE REF TO if_ixml_ostream, 662 | lo_renderer TYPE REF TO if_ixml_renderer. 663 | 664 | lo_word ?= me->ooxml_doc. 665 | 666 | ********************************************************************** 667 | * STEP 1: Create word/fontTable.xml into the root of the ZIP 668 | lo_ixml = cl_ixml=>create( ). 669 | 670 | ********************************************************************** 671 | * STEP 2: Set document attributes 672 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 673 | character_set = 'utf-8' ). 674 | lo_document = lo_ixml->create_document( ). 675 | lo_document->set_encoding( lo_encoding ). 676 | lo_document->set_standalone( abap_true ). 677 | 678 | ********************************************************************** 679 | * STEP 3: Create xstring stream 680 | CLEAR ep_content. 681 | lo_ixml = cl_ixml=>create( ). 682 | lo_streamfactory = lo_ixml->create_stream_factory( ). 683 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 684 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 685 | lo_renderer->render( ). 686 | 687 | endmethod. 688 | 689 | 690 | 691 | method CREATE_WORD_RELATIONSHIPS. 692 | 693 | DATA: lo_word TYPE REF TO /cex/cl_word, 694 | lo_ixml TYPE REF TO if_ixml, 695 | lo_document TYPE REF TO if_ixml_document, 696 | lo_document_xml TYPE REF TO cl_xml_document, 697 | lo_element_root TYPE REF TO if_ixml_node, 698 | lo_element TYPE REF TO if_ixml_element, 699 | lo_node TYPE REF TO if_ixml_node, 700 | lo_encoding TYPE REF TO if_ixml_encoding, 701 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 702 | lo_ostream TYPE REF TO if_ixml_ostream, 703 | lo_renderer TYPE REF TO if_ixml_renderer. 704 | 705 | lo_word ?= me->ooxml_doc. 706 | 707 | ********************************************************************** 708 | * STEP 1: Create word/_rels/document.xml.rels into the root of the ZIP 709 | lo_ixml = cl_ixml=>create( ). 710 | 711 | ********************************************************************** 712 | * STEP 2: Set document attributes 713 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 714 | character_set = 'utf-8' ). 715 | lo_document = lo_ixml->create_document( ). 716 | lo_document->set_encoding( lo_encoding ). 717 | lo_document->set_standalone( abap_true ). 718 | 719 | ********************************************************************** 720 | * STEP 3: Create xstring stream 721 | CLEAR ep_content. 722 | lo_ixml = cl_ixml=>create( ). 723 | lo_streamfactory = lo_ixml->create_stream_factory( ). 724 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 725 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 726 | lo_renderer->render( ). 727 | 728 | endmethod. 729 | 730 | 731 | 732 | method CREATE_WORD_SETTINGS. 733 | 734 | DATA: lo_word TYPE REF TO /cex/cl_word, 735 | lo_ixml TYPE REF TO if_ixml, 736 | lo_document TYPE REF TO if_ixml_document, 737 | lo_document_xml TYPE REF TO cl_xml_document, 738 | lo_element_root TYPE REF TO if_ixml_node, 739 | lo_element TYPE REF TO if_ixml_element, 740 | lo_node TYPE REF TO if_ixml_node, 741 | lo_encoding TYPE REF TO if_ixml_encoding, 742 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 743 | lo_ostream TYPE REF TO if_ixml_ostream, 744 | lo_renderer TYPE REF TO if_ixml_renderer. 745 | 746 | lo_word ?= me->ooxml_doc. 747 | 748 | ********************************************************************** 749 | * STEP 1: Create word/settings.xml into the root of the ZIP 750 | lo_ixml = cl_ixml=>create( ). 751 | 752 | ********************************************************************** 753 | * STEP 2: Set document attributes 754 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 755 | character_set = 'utf-8' ). 756 | lo_document = lo_ixml->create_document( ). 757 | lo_document->set_encoding( lo_encoding ). 758 | lo_document->set_standalone( abap_true ). 759 | 760 | ********************************************************************** 761 | * STEP 3: Create xstring stream 762 | CLEAR ep_content. 763 | lo_ixml = cl_ixml=>create( ). 764 | lo_streamfactory = lo_ixml->create_stream_factory( ). 765 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 766 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 767 | lo_renderer->render( ). 768 | 769 | endmethod. 770 | 771 | 772 | 773 | method CREATE_WORD_STYLES. 774 | 775 | DATA: lo_word TYPE REF TO /cex/cl_word, 776 | lo_ixml TYPE REF TO if_ixml, 777 | lo_document TYPE REF TO if_ixml_document, 778 | lo_document_xml TYPE REF TO cl_xml_document, 779 | lo_element_root TYPE REF TO if_ixml_node, 780 | lo_element TYPE REF TO if_ixml_element, 781 | lo_node TYPE REF TO if_ixml_node, 782 | lo_encoding TYPE REF TO if_ixml_encoding, 783 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 784 | lo_ostream TYPE REF TO if_ixml_ostream, 785 | lo_renderer TYPE REF TO if_ixml_renderer. 786 | 787 | lo_word ?= me->ooxml_doc. 788 | 789 | ********************************************************************** 790 | * STEP 1: Create word/styles.xml into the root of the ZIP 791 | lo_ixml = cl_ixml=>create( ). 792 | 793 | ********************************************************************** 794 | * STEP 2: Set document attributes 795 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 796 | character_set = 'utf-8' ). 797 | lo_document = lo_ixml->create_document( ). 798 | lo_document->set_encoding( lo_encoding ). 799 | lo_document->set_standalone( abap_true ). 800 | 801 | ********************************************************************** 802 | * STEP 3: Create xstring stream 803 | CLEAR ep_content. 804 | lo_ixml = cl_ixml=>create( ). 805 | lo_streamfactory = lo_ixml->create_stream_factory( ). 806 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 807 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 808 | lo_renderer->render( ). 809 | 810 | endmethod. 811 | 812 | 813 | 814 | method CREATE_WORD_STYLESWITHEFFECTS. 815 | 816 | DATA: lo_word TYPE REF TO /cex/cl_word, 817 | lo_ixml TYPE REF TO if_ixml, 818 | lo_document TYPE REF TO if_ixml_document, 819 | lo_document_xml TYPE REF TO cl_xml_document, 820 | lo_element_root TYPE REF TO if_ixml_node, 821 | lo_element TYPE REF TO if_ixml_element, 822 | lo_node TYPE REF TO if_ixml_node, 823 | lo_encoding TYPE REF TO if_ixml_encoding, 824 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 825 | lo_ostream TYPE REF TO if_ixml_ostream, 826 | lo_renderer TYPE REF TO if_ixml_renderer. 827 | 828 | lo_word ?= me->ooxml_doc. 829 | 830 | ********************************************************************** 831 | * STEP 1: Create word/stylesWithEffects.xml into the root of the ZIP 832 | lo_ixml = cl_ixml=>create( ). 833 | 834 | ********************************************************************** 835 | * STEP 2: Set document attributes 836 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 837 | character_set = 'utf-8' ). 838 | lo_document = lo_ixml->create_document( ). 839 | lo_document->set_encoding( lo_encoding ). 840 | lo_document->set_standalone( abap_true ). 841 | 842 | ********************************************************************** 843 | * STEP 3: Create xstring stream 844 | CLEAR ep_content. 845 | lo_ixml = cl_ixml=>create( ). 846 | lo_streamfactory = lo_ixml->create_stream_factory( ). 847 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 848 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 849 | lo_renderer->render( ). 850 | 851 | endmethod. 852 | 853 | 854 | 855 | method CREATE_WORD_THEME. 856 | 857 | DATA: lo_word TYPE REF TO /cex/cl_word, 858 | lo_ixml TYPE REF TO if_ixml, 859 | lo_document TYPE REF TO if_ixml_document, 860 | lo_document_xml TYPE REF TO cl_xml_document, 861 | lo_element_root TYPE REF TO if_ixml_node, 862 | lo_element TYPE REF TO if_ixml_element, 863 | lo_node TYPE REF TO if_ixml_node, 864 | lo_encoding TYPE REF TO if_ixml_encoding, 865 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 866 | lo_ostream TYPE REF TO if_ixml_ostream, 867 | lo_renderer TYPE REF TO if_ixml_renderer. 868 | 869 | lo_word ?= me->ooxml_doc. 870 | 871 | ********************************************************************** 872 | * STEP 1: Create word/theme1.xml into the root of the ZIP 873 | lo_ixml = cl_ixml=>create( ). 874 | 875 | ********************************************************************** 876 | * STEP 2: Set document attributes 877 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 878 | character_set = 'utf-8' ). 879 | lo_document = lo_ixml->create_document( ). 880 | lo_document->set_encoding( lo_encoding ). 881 | lo_document->set_standalone( abap_true ). 882 | 883 | ********************************************************************** 884 | * STEP 3: Create xstring stream 885 | CLEAR ep_content. 886 | lo_ixml = cl_ixml=>create( ). 887 | lo_streamfactory = lo_ixml->create_stream_factory( ). 888 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 889 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 890 | lo_renderer->render( ). 891 | 892 | endmethod. 893 | 894 | 895 | 896 | METHOD create_word_websettings. 897 | 898 | DATA: lo_word TYPE REF TO /cex/cl_word, 899 | lo_ixml TYPE REF TO if_ixml, 900 | lo_document TYPE REF TO if_ixml_document, 901 | lo_document_xml TYPE REF TO cl_xml_document, 902 | lo_element_root TYPE REF TO if_ixml_element, 903 | lo_element TYPE REF TO if_ixml_element, 904 | lo_node TYPE REF TO if_ixml_node, 905 | lo_encoding TYPE REF TO if_ixml_encoding, 906 | lo_streamfactory TYPE REF TO if_ixml_stream_factory, 907 | lo_ostream TYPE REF TO if_ixml_ostream, 908 | lo_renderer TYPE REF TO if_ixml_renderer. 909 | 910 | 911 | DATA: lc_xml_node_websettings TYPE string VALUE 'webSettings', 912 | lc_xml_node_optimizeforbrowser TYPE string VALUE 'optimizeForBrowser', 913 | " Namespace prefix 914 | lc_r_ns TYPE string VALUE 'r', 915 | lc_w_ns TYPE string VALUE 'w', 916 | " Node namespace 917 | lc_xml_node_r_ns TYPE string VALUE 'http://schemas.openxmlformats.org/officeDocument/2006/relationships', 918 | lc_xml_node_w_ns TYPE string VALUE 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'. 919 | 920 | lo_word ?= me->ooxml_doc. 921 | 922 | ********************************************************************** 923 | * STEP 1: Create word/webSettings.xml into the root of the ZIP 924 | lo_ixml = cl_ixml=>create( ). 925 | 926 | ********************************************************************** 927 | * STEP 2: Set document attributes 928 | lo_encoding = lo_ixml->create_encoding( byte_order = if_ixml_encoding=>co_platform_endian 929 | character_set = 'utf-8' ). 930 | lo_document = lo_ixml->create_document( ). 931 | lo_document->set_encoding( lo_encoding ). 932 | lo_document->set_standalone( abap_true ). 933 | 934 | *********************************************************************** 935 | * STEP 3: Create main node relationships 936 | lo_element_root = lo_document->create_simple_element_ns( name = lc_xml_node_websettings 937 | prefix = lc_w_ns 938 | parent = lo_document ). 939 | lo_element_root->set_attribute_ns( name = 'xmlns:r' 940 | value = lc_xml_node_r_ns ). 941 | lo_element_root->set_attribute_ns( name = 'xmlns:w' 942 | value = lc_xml_node_w_ns ). 943 | 944 | ********************************************************************** 945 | * STEP 4: Create subnodes 946 | " body 947 | lo_element = lo_document->create_simple_element_ns( name = lc_xml_node_optimizeforbrowser 948 | prefix = lc_w_ns 949 | parent = lo_document ). 950 | 951 | lo_element_root->append_child( new_child = lo_element ). " optimizeForBrowser 952 | 953 | 954 | ********************************************************************** 955 | * STEP 5: Create xstring stream 956 | CLEAR ep_content. 957 | lo_ixml = cl_ixml=>create( ). 958 | lo_streamfactory = lo_ixml->create_stream_factory( ). 959 | lo_ostream = lo_streamfactory->create_ostream_xstring( string = ep_content ). 960 | lo_renderer = lo_ixml->create_renderer( ostream = lo_ostream document = lo_document ). 961 | lo_renderer->render( ). 962 | 963 | ENDMETHOD. 964 | 965 | 966 | -------------------------------------------------------------------------------- /CEX/ABAP2DOCX/INTF/CEX/IF_WORD_BOOK_PROPERTIES.slnk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /CEX/ABAP2DOCX/PROG/CEX/DEMO_WORD1.slnk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | *&---------------------------------------------------------------------* 9 | *& Report ZABAP2DOCXTEST 10 | *& 11 | *&---------------------------------------------------------------------* 12 | *& 13 | *& 14 | *&---------------------------------------------------------------------* 15 | 16 | REPORT /cex/demo_word1. 17 | 18 | DATA lo_word TYPE REF TO /cex/cl_word. 19 | DATA lo_writer TYPE REF TO /cex/cl_word_writer. 20 | DATA lv_file TYPE xstring. 21 | 22 | CONSTANTS: gc_save_file_name TYPE string VALUE '01_HelloWorld.docx'. 23 | INCLUDE /cex/demo_excel_outputopt_incl. 24 | 25 | START-OF-SELECTION. 26 | CREATE OBJECT lo_word. 27 | 28 | *data lo_paragraph type zcl_paragraph. 29 | *data lv_text type string. 30 | *lo_paragraph = lo_word->add_paragraph( ). 31 | *lo_word->add_text( ip_paragraph = lo_paragraph ip_text = lv_text ). 32 | *lo_paragraph = lo_word->add_paragraph( ). 33 | *lo_word->add_text( ip_paragraph = lo_paragraph ip_text = lv_text ). 34 | 35 | 36 | CREATE OBJECT lo_writer. 37 | lv_file = lo_writer->write_file( lo_word ). 38 | 39 | *** Create output 40 | lcl_output=>output( lv_file ). 41 | 42 | -------------------------------------------------------------------------------- /CEX/ABAP2DOCX/PROG/CEX/DOCX_ZAKE_SVN.slnk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | *&---------------------------------------------------------------------* 9 | *& Report ZDOCX_ZAKE_SVN 10 | *& 11 | *&---------------------------------------------------------------------* 12 | *& Checkout / Checkin the abap2docx Project 13 | *& 14 | *&---------------------------------------------------------------------* 15 | 16 | REPORT /cex/docx_zake_svn. 17 | 18 | CONSTANTS cl_svn TYPE seoclsname VALUE 'ZCL_ZAKE_SVN'. 19 | CONSTANTS cl_tortoise_svn TYPE seoclsname VALUE 'ZCL_ZAKE_TORTOISE_SVN'. 20 | 21 | DATA zake TYPE REF TO zake. 22 | DATA package_obj_name TYPE sobj_name. 23 | 24 | DATA objects TYPE scts_tadir. 25 | DATA object LIKE LINE OF objects. 26 | 27 | DATA files TYPE string_table. 28 | DATA file LIKE LINE OF files. 29 | 30 | DATA zake_build TYPE string. 31 | DATA zake_nuggetname TYPE string. 32 | 33 | DATA comment_str TYPE string. 34 | DATA loclpath_str TYPE string. 35 | DATA svnpath_str TYPE string. 36 | DATA username_str TYPE string. 37 | DATA password_str TYPE string. 38 | DATA class TYPE seoclsname. 39 | 40 | DATA: ex TYPE REF TO zcx_saplink, 41 | message TYPE string. 42 | 43 | SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE a. 44 | PARAMETERS: 45 | checkout TYPE flag RADIOBUTTON GROUP act, 46 | update TYPE flag RADIOBUTTON GROUP act DEFAULT 'X', 47 | install TYPE flag RADIOBUTTON GROUP act, 48 | export TYPE flag RADIOBUTTON GROUP act, 49 | build TYPE flag RADIOBUTTON GROUP act, 50 | checkin TYPE flag RADIOBUTTON GROUP act. 51 | SELECTION-SCREEN END OF BLOCK a. 52 | 53 | SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE b. 54 | PARAMETERS: 55 | svn TYPE flag RADIOBUTTON GROUP cl, 56 | tortoise TYPE flag RADIOBUTTON GROUP cl. 57 | SELECTION-SCREEN END OF BLOCK b. 58 | 59 | SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE c. 60 | PARAMETERS: 61 | loclpath TYPE char512 DEFAULT 'Z:\CodExch\abap2docx\trunk' LOWER CASE OBLIGATORY, 62 | zakenugg TYPE char512 DEFAULT 'Z:\CodExch\abap2docx\build\abap2docx_Daily.nugg' LOWER CASE OBLIGATORY, 63 | svnpath TYPE char512 DEFAULT 'https://code.sdn.sap.com/svn/abap2docx' LOWER CASE OBLIGATORY, 64 | package TYPE devclass DEFAULT '/CEX/ABAP2DOCX', 65 | comment TYPE char512 DEFAULT '' LOWER CASE, 66 | username TYPE char512 LOWER CASE, 67 | password TYPE char512 LOWER CASE, 68 | setpack TYPE flag DEFAULT 'X', 69 | testrun TYPE flag DEFAULT 'X'. 70 | SELECTION-SCREEN END OF BLOCK c. 71 | 72 | INITIALIZATION. 73 | a = 'Action'. 74 | b = 'Version Controll Program'. 75 | c = 'Parameters'. 76 | 77 | START-OF-SELECTION. 78 | 79 | svnpath_str = svnpath. 80 | loclpath_str = loclpath. 81 | zake_nuggetname = zakenugg. 82 | comment_str = comment. 83 | 84 | SELECT * INTO TABLE objects FROM tadir WHERE devclass = package. 85 | DELETE objects WHERE object = 'DEVC'. 86 | 87 | TRY. 88 | IF svn = 'X'. 89 | class = cl_svn. 90 | ELSE. 91 | class = cl_tortoise_svn. 92 | ENDIF. 93 | 94 | CREATE OBJECT zake 95 | TYPE 96 | (class) 97 | EXPORTING 98 | i_svnpath = svnpath_str 99 | i_localpath = loclpath_str. 100 | zake->set_testrun( testrun ). 101 | zake->set_package( package ). 102 | 103 | IF checkout = 'X'. 104 | zake->checkout( ). 105 | ELSEIF update = 'X'. 106 | zake->update( ). 107 | ELSEIF install = 'X'. 108 | zake->install_slinkees_from_lm( testrun ). 109 | IF setpack = abap_true. 110 | zake->set_package_of_package_objects( ). 111 | ENDIF. 112 | " zake->install_objects( zake_objects ). 113 | ELSEIF export = 'X'. 114 | " Build Object list for Export 115 | " Programs 116 | * object-object = 'PROG'. 117 | * object-obj_name = 'ZDOCX_ZAKE_SVN'. 118 | * APPEND object TO objects. 119 | * zake->set_checkin_objects( objects ). 120 | zake->set_package_objects( i_package = package ). 121 | package_obj_name = package. 122 | zake->unset_checkin_object_by_name( 123 | EXPORTING 124 | i_object = 'DEVC' " Object Type 125 | i_object_name = package_obj_name " Object Name in Object Directory 126 | ). 127 | zake->download_slinkees_to_lm = abap_true. 128 | zake->download_nugget_to_lm = space. 129 | zake->download_zip_to_lm_flag = space. 130 | zake->create_slinkees( zake_nuggetname ). 131 | ELSEIF build = 'X'. 132 | " Build a complete package for download 133 | zake->set_checkin_objects( objects ). 134 | " We don't want that for the complete Package Slinkees are created 135 | " in the ZAKE folder 136 | zake->download_slinkees_to_lm = space. 137 | zake->download_nugget_to_lm = space. 138 | zake->create_slinkees( zake_nuggetname ). 139 | ELSEIF checkin = 'X'. 140 | zake->set_package( package ). 141 | zake->set_checkin_objects( objects ). 142 | zake->create_slinkees( zake_nuggetname ). 143 | IF testrun IS INITIAL. 144 | zake->checkin( comment_str ). 145 | ENDIF. 146 | ENDIF. 147 | CATCH zcx_saplink INTO ex. 148 | message = ex->msg. 149 | WRITE: / 'An Error occured: ', message. 150 | ENDTRY. 151 | 152 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ivanfemia/abap2docx/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 2 | -------------------------------------------------------------------------------- /build/abap2docx_Daily.nugg.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ivanfemia/abap2docx/4ef4dff935529f80ad8b6e157d11f71fe49c9116/build/abap2docx_Daily.nugg.zip --------------------------------------------------------------------------------