function cbMakeDocxDocument(data) {
    data.docStartExtra = data.docStartExtra || ''
    data.docEndExtra = data.docEndExtra || ''

    var outString =
      gen_private.plugs.type.msoffice.cbMakeMsOfficeBasicXml(data) +
      '<w:' +
      data.docType +
      ' xmlns:ve="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:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">' +
      data.docStartExtra
    var objs_list = data.data
    var bookmarkId = 0

    // In case of an empty document - just place an empty paragraph:
    if (!objs_list.length) {
      outString += '<w:p w:rsidR="009F2180" w:rsidRDefault="009F2180">'
      if (data.pStyleDef) {
        outString += '<w:pPr><w:pStyle w:val="' + data.pStyleDef + '"/></w:pPr>'
      } // Endif.

      outString += '</w:p>'
    } // Endif.

    // BMK_DOCX_P: Work on all the stored paragraphs inside this document:
    for (var i = 0, total_size = objs_list.length; i < total_size; i++) {
      if (objs_list[i] && objs_list[i].type === 'table') {
        var table_obj = docxTable.getTable(
          objs_list[i].data,
          objs_list[i].options
        )
        var table_xml = xmlBuilder
          .create(table_obj, {
            version: '1.0',
            encoding: 'UTF-8',
            separateArrayItems: true,
            standalone: true
          })
          .toString({ pretty: true, indent: '  ', newline: '\n' })
        outString += table_xml
        continue
      } // Endif.

      outString += '<w:p w:rsidR="00A77427" w:rsidRDefault="007F1D13">'
      var pPrData = ''

      if (objs_list[i].options) {
        pPrData += '<w:ind'
        if (objs_list[i].options.indentLeft) {
          pPrData += ` w:left="${objs_list[i].options.indentLeft}"`
        }
        if (objs_list[i].options.indentFirstLine) {
          pPrData += ` w:firstLine="${objs_list[i].options.indentFirstLine}"`
        }
        pPrData += '/>'

        if (objs_list[i].options.align) {
          switch (objs_list[i].options.align) {
            case 'center':
              pPrData += '<w:jc w:val="center"/>'
              break

            case 'right':
              pPrData += '<w:jc w:val="right"/>'
              break

            case 'justify':
              pPrData += '<w:jc w:val="both"/>'
              break
          } // End of switch.
        } // Endif.

        if (objs_list[i].options.list_type) {
          pPrData +=
            '<w:pStyle w:val="ListParagraph"/><w:numPr><w:ilvl w:val="' +
            objs_list[i].options.list_level +
            '"/><w:numId w:val="' +
            objs_list[i].options.list_type +
            '"/></w:numPr>'
        } // Endif.

        if (objs_list[i].options.backline) {
          pPrData +=
            '<w:pPr><w:shd w:val="solid" w:color="' +
            objs_list[i].options.backline +
            '" w:fill="auto"/></w:pPr>'
        } // Endif.

        if (objs_list[i].options.spacing) {
          var pSpacing = objs_list[i].options.spacing
          if (typeof pSpacing === 'object') {
            pPrData += '<w:spacing'
            for (var pSpacingKey of [
              'before',
              'after',
              'line',
              'lineRule',
              'beforeAutospacing',
              'afterAutospacing'
            ]) {
              if (pSpacingKey in pSpacing)
                pPrData +=
                  ' w:' + pSpacingKey + '="' + pSpacing[pSpacingKey] + '"'
            }
            pPrData += '/>'
          } // Endif.
        } // Endif.

        if (objs_list[i].options.rtl) {
          pPrData += '<w:bidi w:val="1"/>'
        } // Endif.

        if (objs_list[i].options.textAlignment) {
          pPrData +=
            '<w:textAlignment w:val="' +
            objs_list[i].options.textAlignment +
            '"/>'
        } // Endif.
      } // Endif.

      // Some resource types have default style in case that there's no style settings:
      var pStyleDef =
        (objs_list[i].options && objs_list[i].options.pStyleDef) ||
        data.pStyleDef
      if (!pPrData && pStyleDef) {
        pPrData = '<w:pStyle w:val="' + pStyleDef + '"/>'
      } else if (objs_list[i].options && objs_list[i].options.force_style) {
        pPrData = '<w:pStyle w:val="' + objs_list[i].options.force_style + '"/>'
      } // Endif.

      if (pPrData) {
        outString += '<w:pPr>' + pPrData + '</w:pPr>'
      } // Endif.

      // Work on all the objects in the document:
      for (
        var j = 0, total_size_j = objs_list[i].data.length;
        j < total_size_j;
        j++
      ) {
        if (objs_list[i].data[j]) {
          var rExtra = ''
          var tExtra = ''
          var rPrData = ''
          var colorCode
          var valType
          var sizeVal
          var hyperlinkOn = false

          if (objs_list[i].data[j].options) {
            if (objs_list[i].data[j].options.color) {
              rPrData +=
                '<w:color w:val="' + objs_list[i].data[j].options.color + '"/>'
            } // Endif.

            if (objs_list[i].data[j].options.back) {
              colorCode = objs_list[i].data[j].options.shdColor || 'auto'
              valType = objs_list[i].data[j].options.shdType || 'clear'

              rPrData +=
                '<w:shd w:val="' +
                valType +
                '" w:color="' +
                colorCode +
                '" w:fill="' +
                objs_list[i].data[j].options.back +
                '"/>'
            } // Endif.

            if (objs_list[i].data[j].options.highlight) {
              valType = 'yellow'

              if (typeof objs_list[i].data[j].options.highlight === 'string') {
                valType = objs_list[i].data[j].options.highlight
              } // Endif.

              rPrData += '<w:highlight w:val="' + valType + '"/>'
            } // Endif.

            if (objs_list[i].data[j].options.bold) {
              rPrData += '<w:b/><w:bCs/>'
            } // Endif.

            if (objs_list[i].data[j].options.italic) {
              rPrData += '<w:i/><w:iCs/>'
            } // Endif.

            if (objs_list[i].data[j].options.underline) {
              valType = 'single'

              if (typeof objs_list[i].data[j].options.underline === 'string') {
                valType = objs_list[i].data[j].options.underline
              } // Endif.

              rPrData += '<w:u w:val="' + valType + '"/>'
            } // Endif.

            // Since officegen 0.5.0 and later:
            if (objs_list[i].data[j].options.superscript) {
              rPrData += '<w:vertAlign w:val="superscript" />'
            } else if (objs_list[i].data[j].options.subscript) {
              rPrData += '<w:vertAlign w:val="subscript" />'
            } // Endif.

            if (objs_list[i].data[j].options.strikethrough) {
              rPrData += '<w:strike/>'
            } // Endif.

            var fontFaceInfo = ''
            if (objs_list[i].data[j].options.font_face) {
              fontFaceInfo +=
                ' w:ascii="' +
                objs_list[i].data[j].options.font_face +
                '" w:eastAsia="' +
                (objs_list[i].data[j].options.font_face_east ||
                  objs_list[i].data[j].options.font_face) +
                '" w:hAnsi="' +
                (objs_list[i].data[j].options.font_face_h ||
                  objs_list[i].data[j].options.font_face) +
                '" w:cs="' +
                (objs_list[i].data[j].options.font_face_cs ||
                  objs_list[i].data[j].options.font_face) +
                '"'
            } // Endif.

            if (
              objs_list[i].data[j].options.font_hint ||
              objs_list[i].data[j].options.font_rtl
            ) {
              fontFaceInfo +=
                ' w:hint="' +
                (objs_list[i].data[j].options.font_hint || 'cs') +
                '"'
            } // Endif.

            if (fontFaceInfo) {
              rPrData += '<w:rFonts' + fontFaceInfo + ' />'
            } // Endif.

            if (objs_list[i].data[j].options.font_size) {
              var fontSizeInHalfPoints =
                2 * objs_list[i].data[j].options.font_size
              rPrData +=
                '<w:sz w:val="' +
                fontSizeInHalfPoints +
                '"/><w:szCs w:val="' +
                fontSizeInHalfPoints +
                '"/>'
            } // Endif.

            if (objs_list[i].data[j].options.border) {
              colorCode = 'auto'
              valType = 'single'
              sizeVal = 4

              if (
                typeof objs_list[i].data[j].options.borderColor === 'string'
              ) {
                colorCode = objs_list[i].data[j].options.borderColor
              } // Endif.

              if (typeof objs_list[i].data[j].options.border === 'string') {
                valType = objs_list[i].data[j].options.border
              } // Endif.

              /* eslint-disable no-self-compare */
              if (
                typeof objs_list[i].data[j].options.borderSize === 'number' &&
                objs_list[i].data[j].options.borderSize &&
                objs_list[i].data[j].options.borderSize ===
                  objs_list[i].data[j].options.borderSize
              ) {
                sizeVal = objs_list[i].data[j].options.borderSize
              } // Endif.

              rPrData +=
                '<w:bdr w:val="' +
                valType +
                '" w:sz="' +
                sizeVal +
                '" w:space="0" w:color="' +
                colorCode +
                '"/>'
            } // Endif.

            // Hyperlink support:
            if (objs_list[i].data[j].options.hyperlink) {
              outString +=
                '<w:hyperlink w:anchor="' +
                objs_list[i].data[j].options.hyperlink +
                '">'
              hyperlinkOn = true

              if (!rPrData) {
                rPrData = '<w:rStyle w:val="Hyperlink"/>'
              } // Endif.
            } // Endif.

            if (objs_list[i].data[j].options.rtl) {
              rPrData += '<w:rtl w:val="1"/>'
            } // Endif.

            if (objs_list[i].data[j].options.lang) {
              outString += '<w:lang w:bidi="' + objs_list[i].data[j].lang + '">'
            } // Endif.
          } // Endif.

          // Field support:
          if (objs_list[i].data[j].fieldObj) {
            outString +=
              '<w:fldSimple w:instr="' + objs_list[i].data[j].fieldObj + '">'
          } // Endif.

          if (objs_list[i].data[j].text) {
            if (
              objs_list[i].data[j].text[0] === ' ' ||
              objs_list[i].data[j].text[
                objs_list[i].data[j].text.length - 1
              ] === ' '
            ) {
              tExtra += ' xml:space="preserve"'
            } // Endif.

            if (objs_list[i].data[j].link_rel_id) {
              outString +=
                '<w:hyperlink r:id="rId' +
                objs_list[i].data[j].link_rel_id +
                '">'
            }

            outString += '<w:r' + rExtra + '>'

            if (rPrData) {
              outString += '<w:rPr>' + rPrData + '</w:rPr>'
            } // Endif.

            outString +=
              '<w:t' +
              tExtra +
              '>' +
              gen_private.plugs.type.msoffice.escapeText(
                objs_list[i].data[j].text
              ) +
              '</w:t></w:r>'

            if (objs_list[i].data[j].link_rel_id) {
              outString += '</w:hyperlink>'
            }
          } else if (objs_list[i].data[j].page_break) {
            outString += '<w:r><w:br w:type="page"/></w:r>'
          } else if (objs_list[i].data[j].line_break) {
            outString += '<w:r><w:br/></w:r>'
          } else if (objs_list[i].data[j].horizontal_line) {
            outString +=
              '<w:r><w:pict><v:rect style="width:0height:.75pt" o:hralign="center" o:hrstd="t" o:hr="t" fillcolor="#e0e0e0" stroked="f"/></w:pict></w:r>'

            // Bookmark start support:
          } else if (objs_list[i].data[j].bookmark_start) {
            outString +=
              '<w:bookmarkStart w:id="' +
              bookmarkId +
              '" w:name="' +
              objs_list[i].data[j].bookmark_start +
              '"/>'

            // Bookmark end support:
          } else if (objs_list[i].data[j].bookmark_end) {
            outString += '<w:bookmarkEnd w:id="' + bookmarkId + '"/>'
            bookmarkId++
          } else if (objs_list[i].data[j].image) {
            outString += '<w:r' + rExtra + '>'

            rPrData += '<w:noProof/>'

            if (rPrData) {
              outString += '<w:rPr>' + rPrData + '</w:rPr>'
            } // Endif.

            // 914400L / 96DPI
            var pixelToEmu = 9525

            outString += '<w:drawing>'
            outString += '<wp:inline distT="0" distB="0" distL="0" distR="0">'
            outString +=
              '<wp:extent cx="' +
              parseSmartNumber(
                objs_list[i].data[j].options.cx,
                10000, // BMK_TODO: Change it to the maximum X size.
                320,
                10000, // BMK_TODO: Change it to the maximum X size.
                pixelToEmu
              ) +
              '" cy="' +
              parseSmartNumber(
                objs_list[i].data[j].options.cy,
                10000, // BMK_TODO: Change it to the maximum Y size.
                200,
                10000, // BMK_TODO: Change it to the maximum Y size.
                pixelToEmu
              ) +
              '"/>'
            outString += '<wp:effectExtent l="19050" t="0" r="9525" b="0"/>'

            outString +=
              '<wp:docPr id="' +
              (objs_list[i].data[j].image_id + 1) +
              '" name="Picture ' +
              objs_list[i].data[j].image_id +
              '" descr="Picture ' +
              objs_list[i].data[j].image_id +
              '">'
            if (objs_list[i].data[j].link_rel_id) {
              outString +=
                '<a:hlinkClick xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" r:id="rId' +
                objs_list[i].data[j].link_rel_id +
                '"/>'
            }
            outString += '</wp:docPr>'

            outString += '<wp:cNvGraphicFramePr>'
            outString +=
              '<a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/>'
            outString += '</wp:cNvGraphicFramePr>'
            outString +=
              '<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">'
            outString +=
              '<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">'
            outString +=
              '<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">'
            outString += '<pic:nvPicPr>'
            outString +=
              '<pic:cNvPr id="0" name="Picture ' +
              objs_list[i].data[j].image_id +
              '"/>'
            outString += '<pic:cNvPicPr/>'
            outString += '</pic:nvPicPr>'
            outString += '<pic:blipFill>'
            outString +=
              '<a:blip r:embed="rId' +
              objs_list[i].data[j].rel_id +
              '" cstate="print"/>'
            outString += '<a:stretch>'
            outString += '<a:fillRect/>'
            outString += '</a:stretch>'
            outString += '</pic:blipFill>'
            outString += '<pic:spPr>'
            outString += '<a:xfrm>'
            outString += '<a:off x="0" y="0"/>'
            outString +=
              '<a:ext cx="' +
              Math.round(objs_list[i].data[j].options.cx * pixelToEmu) +
              '" cy="' +
              Math.round(objs_list[i].data[j].options.cy * pixelToEmu) +
              '"/>'
            outString += '</a:xfrm>'
            outString += '<a:prstGeom prst="rect">'
            outString += '<a:avLst/>'
            outString += '</a:prstGeom>'
            outString += '</pic:spPr>'
            outString += '</pic:pic>'
            outString += '</a:graphicData>'
            outString += '</a:graphic>'
            outString += '</wp:inline>'
            outString += '</w:drawing>'

            outString += '</w:r>'
          } // Endif.

          // Field support:
          if (objs_list[i].data[j].fieldObj) {
            outString += '</w:fldSimple>'
          } // Endif.

          if (hyperlinkOn) {
            outString += '</w:hyperlink>'
          } // Endif.
        } // Endif.
      } // Endif.

      outString += '</w:p>'
    } // End of for loop.

    if (data.docType === 'document') {
      outString += '<w:p w:rsidR="00A02F19" w:rsidRDefault="00A02F19"/>'

      var margins
      let width = 11906
      let height = 16838
      if (options.pageSize) {
        if (typeof options.pageSize === 'string') {
          switch (options.pageSize) {
            case 'A3':
              width = 16838
              height = 23811
              break
            case 'A4':
              width = 11906
              height = 16838
              break
            case 'letter paper':
              width = 15840
              height = 12240
              break
            default:
              // default is A4
              width = 11906
              height = 16838
              break
          }
        }
      }

      // Landscape orientation support:
      if (options.orientation && options.orientation === 'landscape') {
        margins = options.pageMargins || {
          top: 1800,
          right: 1440,
          bottom: 1800,
          left: 1440
        }
        width = (options.pageSize && options.pageSize.height) || width
        height = (options.pageSize && options.pageSize.width) || height

        outString +=
          '<w:sectPr w:rsidR="00A02F19" w:rsidSect="00897086">' +
          (docxData.secPrExtra ? docxData.secPrExtra : '') +
          `<w:pgSz w:w="${height}" w:h="${width}" w:orient="landscape"/>` +
          '<w:pgMar w:top="' +
          margins.top +
          '" w:right="' +
          margins.right +
          '" w:bottom="' +
          margins.bottom +
          '" w:left="' +
          margins.left +
          '" w:header="720" w:footer="720" w:gutter="0"/>' +
          '<w:cols' +
          (options.columns ? ' w:num="' + options.columns + '"' : '') +
          ' w:space="720"/>' +
          '<w:docGrid w:linePitch="360"/>' +
          '</w:sectPr>'
      } else {
        margins = options.pageMargins || {
          top: 1440,
          right: 1800,
          bottom: 1440,
          left: 1800
        }
        width = (options.pageSize && options.pageSize.width) || width
        height = (options.pageSize && options.pageSize.height) || height

        outString +=
          '<w:sectPr w:rsidR="00A02F19" w:rsidSect="00A02F19">' +
          (docxData.secPrExtra ? docxData.secPrExtra : '') +
          `<w:pgSz w:w="${width}" w:h="${height}"/>` +
          '<w:pgMar w:top="' +
          margins.top +
          '" w:right="' +
          margins.right +
          '" w:bottom="' +
          margins.bottom +
          '" w:left="' +
          margins.left +
          '" w:header="720" w:footer="720" w:gutter="0"/>' +
          '<w:cols' +
          (options.columns ? ' w:num="' + options.columns + '"' : '') +
          ' w:space="720"/>' +
          '<w:docGrid w:linePitch="360"/>' +
          '</w:sectPr>'
      } // Endif.
    } // Endif.

    outString += data.docEndExtra + '</w:' + data.docType + '>'

    return outString
  }
Create the document's itself resource.

@param[in] data Ignored by this callback function.
@return Text string.