all files / document-editor/implementation/writer/ html-export.js

79.69% Statements 561/704
58.1% Branches 373/642
85.71% Functions 36/42
79.69% Lines 561/704
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055     11× 11× 11× 11× 11×   11× 13×   11×   11× 11×                     18× 18× 18× 18× 133× 133× 120× 120×   13×         18×           18× 18× 18× 18×   183× 183× 183× 183× 183× 183× 29×   183× 183× 183× 183× 183× 154×   183× 18×   183×   183×   183×     183× 167×   183× 30×   183× 19×   183× 183× 30×     153× 153× 153×   183× 73×     110×   183× 30× 30×   24× 13×       153×   183×   198× 198× 14×       14×   198×   303× 303× 303× 3645× 60× 60×     303× 60× 510× 60× 60× 60×       303×   19× 19×                           13× 13×                     13×   19×   110× 110× 110× 110× 187× 187×     178×   178×     178×                                                                 178× 178×         178× 178×   178×           178×       178×   110×         178× 178×       178×       178× 178× 178× 178× 178× 178× 178× 178×   306×                     302×                                       61× 61× 61× 61× 61× 61× 40×   61×     61×     61× 61× 61×   61×   61× 61×   61×   61×   61×   61× 61×     61× 35×   61× 61× 63× 63×       63×     61× 61×   61×               61×     25×     25× 25× 25× 61×   25×   183× 183× 183×     183× 110×   183× 183× 73×   183× 183× 183×   356×                     61× 61× 61× 61× 33× 33× 33×   28×     28× 28× 28×           61× 61× 33× 33× 33×   28×     28× 28× 28×           61× 61× 33× 33× 33×   28×     28× 28× 28×           61× 61× 34× 34× 34×   27×     27× 27× 27×           61×   161× 161× 161× 161× 161×   161× 161×   161×   161×     161×                                                                                                                               1298× 649×   649× 649× 649× 649× 649× 649× 649× 649× 649×       649×   649× 649× 649× 10× 10× 10× 10×   649× 72× 72× 72× 72×   649× 649× 303× 303× 303× 303×   649×   649× 649× 535× 535× 535× 535× 535×   649× 649× 535× 535× 535× 535×   649× 649× 295× 295× 295× 295× 295×   649× 649× 295× 295× 295× 295×   649×   649× 649× 649×   649× 11×   649× 11×   649×   366×     366× 183×   183× 183× 183× 183× 183×   183× 183× 183×   183× 183× 183×   183× 183× 183×   183× 183× 30×   183× 183×   183× 183× 30×   183×     183×     183× 183× 183× 183× 183× 183× 130×   53× 52×       183×                                                                                                                   458× 458× 458× 458× 613× 613×   458× 458×   458×     447× 447× 447× 447× 447× 447×                                                       72× 72×   12× 12×                                   72×   183×             177×       25× 25× 25×   25× 25× 25×   25×                 178×     178× 178× 178× 178× 178× 178× 403×     178×        
define(["require", "exports", "@syncfusion/ej2-base", "../editor/editor-helper", "../../index"], function (require, exports, ej2_base_1, editor_helper_1, index_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var HtmlExport = (function () {
        function HtmlExport() {
            this.document = undefined;
            this.prevListLevel = undefined;
            this.isOrdered = undefined;
            this.keywordIndex = undefined;
            this.fieldCheck = 0;
        }
        HtmlExport.prototype.writeHtml = function (document, isOptimizeSfdt) {
            this.keywordIndex = isOptimizeSfdt ? 1 : 0;
            this.document = document;
            var html = '';
            Eif (document.hasOwnProperty(index_1.imagesProperty[this.keywordIndex])) {
                this.serializeImages(document[index_1.imagesProperty[this.keywordIndex]]);
            }
            for (var i = 0; i < document[index_1.sectionsProperty[this.keywordIndex]].length; i++) {
                html += this.serializeSection(document[index_1.sectionsProperty[this.keywordIndex]][i]);
            }
            return html;
        };
        HtmlExport.prototype.serializeImages = function (data) {
            this.images = new index_1.Dictionary();
            for (var img in data) {
                if (Array.isArray(data["" + img])) {
                    this.images.add(parseInt(img), data["" + img]);
                }
                else {
                    var images = [];
                    images.push(data["" + img]);
                    this.images.add(parseInt(img), images);
                }
            }
        };
        HtmlExport.prototype.serializeSection = function (section) {
            var string = '';
            var listLevel = undefined;
            var listCloseCount = [];
            for (var i = 0; i < section[index_1.blocksProperty[this.keywordIndex]].length; i++) {
                var block = section[index_1.blocksProperty[this.keywordIndex]][i];
                if (block.hasOwnProperty(index_1.inlinesProperty[this.keywordIndex])) {
                    string += this.serializeParagraph(block, listCloseCount);
                    listLevel = this.getListLevel(block);
                }
                else if (block.hasOwnProperty(index_1.blocksProperty[this.keywordIndex])) {
                    string += this.serializeSection(block);
                }
                else {
                    string += this.closeList();
                    string += this.serializeTable(block);
                }
            }
            Iif (listCloseCount.length > 0 && (ej2_base_1.isNullOrUndefined(listLevel) || ej2_base_1.isNullOrUndefined(this.prevListLevel) || (this.prevListLevel[index_1.restartLevelProperty[this.keywordIndex]] === listLevel[index_1.restartLevelProperty[this.keywordIndex]] && this.prevListLevel[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]] === listLevel[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]]))) {
                while (listCloseCount.length > 0) {
                    string += this.closeList();
                    listCloseCount.pop();
                }
            }
            string += this.closeList();
            this.prevListLevel = undefined;
            this.isOrdered = undefined;
            return string;
        };
        HtmlExport.prototype.serializeParagraph = function (paragraph, listCloseCount) {
            var blockStyle = '';
            var isList = false;
            var isPreviousList = false;
            var restartLevel = undefined;
            var leftIndent = 0;
            if (!ej2_base_1.isNullOrUndefined(this.prevListLevel)) {
                isPreviousList = true;
            }
            var tagAttributes = [];
            var listLevel = undefined;
            Eif (!ej2_base_1.isNullOrUndefined(paragraph[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.listFormatProperty[this.keywordIndex]])) {
                listLevel = this.getListLevel(paragraph);
                if (!isPreviousList) {
                    this.prevListLevel = listLevel;
                }
                if (this.prevListLevel !== listLevel) {
                    isPreviousList = false;
                }
                if (!ej2_base_1.isNullOrUndefined(listCloseCount) && !ej2_base_1.isNullOrUndefined(listLevel) && !ej2_base_1.isNullOrUndefined(this.prevListLevel) && ((this.prevListLevel[index_1.restartLevelProperty[this.keywordIndex]] < listLevel[index_1.restartLevelProperty[this.keywordIndex]] && this.prevListLevel !== listLevel) || (this.prevListLevel[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]] !== listLevel[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]]))) {
                    listCloseCount.push(listCloseCount.length);
                    restartLevel = this.prevListLevel[index_1.restartLevelProperty[this.keywordIndex]];
                    leftIndent = this.prevListLevel[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]];
                }
                this.prevListLevel = listLevel;
            }
            if (!ej2_base_1.isNullOrUndefined(listCloseCount) && listCloseCount.length > 0 && (ej2_base_1.isNullOrUndefined(listLevel) || ej2_base_1.isNullOrUndefined(this.prevListLevel) || (this.prevListLevel[index_1.restartLevelProperty[this.keywordIndex]] === restartLevel && this.prevListLevel[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]] === leftIndent))) {
                while (listCloseCount.length > 0) {
                    blockStyle += this.closeList();
                    listCloseCount.pop();
                }
            }
            if (!isPreviousList && !(listCloseCount && listCloseCount.length !== 0)) {
                blockStyle += this.closeList();
            }
            if (!ej2_base_1.isNullOrUndefined(listLevel)) {
                isList = true;
            }
            if (isList && !isPreviousList) {
                blockStyle += this.getHtmlList(listLevel, paragraph[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.listFormatProperty[this.keywordIndex]][index_1.listLevelNumberProperty[this.keywordIndex]]);
            }
            tagAttributes.push('style="' + this.serializeParagraphStyle(paragraph, '', isList) + ';' + 'white-space:pre' + '"');
            if (isList) {
                blockStyle += this.createAttributesTag('li', tagAttributes);
            }
            else {
                this.prevListLevel = undefined;
                this.isOrdered = undefined;
                blockStyle += this.createAttributesTag(this.getStyleName(paragraph[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.styleNameProperty[this.keywordIndex]]), tagAttributes);
            }
            if (paragraph[index_1.inlinesProperty[this.keywordIndex]].length === 0) {
                blockStyle += '<span />';
            }
            else {
                blockStyle = this.serializeInlines(paragraph, blockStyle);
            }
            if (isList) {
                blockStyle += this.endTag('li');
                if (blockStyle.indexOf('<ul') > -1) {
                    this.isOrdered = false;
                }
                else if (blockStyle.indexOf('<ol') > -1) {
                    this.isOrdered = true;
                }
            }
            else {
                blockStyle += this.endTag(this.getStyleName(paragraph[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.styleNameProperty[this.keywordIndex]]));
            }
            return blockStyle;
        };
        HtmlExport.prototype.closeList = function () {
            var blockStyle = '';
            if (!ej2_base_1.isNullOrUndefined(this.isOrdered)) {
                if (this.isOrdered) {
                    blockStyle = this.endTag('ol');
                }
                else {
                    blockStyle = this.endTag('ul');
                }
                this.isOrdered = undefined;
            }
            return blockStyle;
        };
        HtmlExport.prototype.getListLevel = function (paragraph) {
            var listLevel = undefined;
            var list = undefined;
            for (var i = 0; i < this.document[index_1.listsProperty[this.keywordIndex]].length; i++) {
                if (this.document[index_1.listsProperty[this.keywordIndex]][i][index_1.listIdProperty[this.keywordIndex]] === paragraph[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.listFormatProperty[this.keywordIndex]][index_1.listIdProperty[this.keywordIndex]]) {
                    list = this.document[index_1.listsProperty[this.keywordIndex]][i];
                    break;
                }
            }
            if (list) {
                for (var j = 0; j < this.document[index_1.abstractListsProperty[this.keywordIndex]].length; j++) {
                    if (this.document[index_1.abstractListsProperty[this.keywordIndex]][j][index_1.abstractListIdProperty[this.keywordIndex]] === list[index_1.abstractListIdProperty[this.keywordIndex]]) {
                        var levelNumber = paragraph[index_1.paragraphFormatProperty[this.keywordIndex]][index_1.listFormatProperty[this.keywordIndex]][index_1.listLevelNumberProperty[this.keywordIndex]];
                        listLevel = this.document[index_1.abstractListsProperty[this.keywordIndex]][j][index_1.levelsProperty[this.keywordIndex]][levelNumber];
                        break;
                    }
                }
            }
            return listLevel;
        };
        HtmlExport.prototype.getHtmlList = function (listLevel, levelNumer) {
            var html = '';
            if (listLevel[index_1.listLevelPatternProperty[this.keywordIndex]] === (this.keywordIndex == 1 ? 10 : 'Bullet')) {
                html += '<ul type="';
                switch (levelNumer) {
                    case 0:
                        html += 'disc';
                        listLevel[index_1.characterFormatProperty[this.keywordIndex]][index_1.fontFamilyProperty[this.keywordIndex]] = 'Symbol';
                        break;
                    case 1:
                        html += 'circle';
                        listLevel[index_1.characterFormatProperty[this.keywordIndex]][index_1.fontFamilyProperty[this.keywordIndex]] = 'Symbol';
                        break;
                    case 2:
                        html += 'square';
                        listLevel[index_1.characterFormatProperty[this.keywordIndex]][index_1.fontFamilyProperty[this.keywordIndex]] = 'Wingdings';
                        break;
                    default:
                        html += 'disc';
                        listLevel[index_1.characterFormatProperty[this.keywordIndex]][index_1.fontFamilyProperty[this.keywordIndex]] = 'Symbol';
                        break;
                }
                html += '">';
            }
            else {
                html += '<ol type="';
                switch (listLevel[index_1.listLevelPatternProperty[this.keywordIndex]]) {
                    case 'UpRoman':
                    case 2:
                        html += 'I';
                        break;
                    case 'LowRoman':
                    case 3:
                        html += 'i';
                        break;
                    case 'UpLetter':
                    case 4:
                        html += 'A';
                        break;
                    case 'LowLetter':
                    case 5:
                        html += 'a';
                        break;
                    default:
                        html += '1';
                        break;
                }
                html += '" start="' + listLevel[index_1.startAtProperty[this.keywordIndex]].toString() + '">';
            }
            return html;
        };
        HtmlExport.prototype.serializeInlines = function (paragraph, blockStyle) {
            var inline = undefined;
            var i = 0;
            var tabCount = 0;
            while (paragraph[index_1.inlinesProperty[this.keywordIndex]].length > i) {
                inline = paragraph[index_1.inlinesProperty[this.keywordIndex]][i];
                if ((inline.hasOwnProperty(index_1.textProperty[this.keywordIndex])
                    && inline[index_1.textProperty[this.keywordIndex]] === '\t')) {
                    tabCount++;
                    i++;
                    continue;
                }
                else if (tabCount > 0) {
                    var tagAttributes = [];
                    tagAttributes.push('style="mso-tab-count:' + tabCount.toString() + '"');
                    blockStyle += this.createAttributesTag('span', tagAttributes) + this.endTag('span');
                    tabCount = 0;
                }
                Iif (inline.hasOwnProperty(index_1.imageStringProperty[this.keywordIndex])) {
                    blockStyle += this.serializeImageContainer(inline);
                }
                else Iif (inline.hasOwnProperty(index_1.fieldTypeProperty[this.keywordIndex])) {
                    if (inline[index_1.fieldTypeProperty[this.keywordIndex]] === 0) {
                        var fieldCode = paragraph[index_1.inlinesProperty[this.keywordIndex]][i + 1];
                        if (ej2_base_1.isNullOrUndefined(fieldCode[index_1.textProperty[this.keywordIndex]])) {
                            fieldCode = paragraph[index_1.inlinesProperty[this.keywordIndex]][i + 2];
                        }
                        if (!ej2_base_1.isNullOrUndefined(fieldCode) && !ej2_base_1.isNullOrUndefined(fieldCode[index_1.textProperty[this.keywordIndex]]) &&
                            (fieldCode[index_1.textProperty[this.keywordIndex]].indexOf('TOC') >= 0 || fieldCode[index_1.textProperty[this.keywordIndex]].indexOf('HYPERLINK') >= 0)) {
                            this.fieldCheck = 1;
                            var tagAttributes = [];
                            tagAttributes.push('style="' + this.serializeInlineStyle(inline[index_1.characterFormatProperty[this.keywordIndex]]) + '"');
                            blockStyle += this.createAttributesTag('a', tagAttributes);
                        }
                        else {
                            this.fieldCheck = undefined;
                        }
                    }
                    else if (inline[index_1.fieldTypeProperty[this.keywordIndex]] === 2) {
                        if (!ej2_base_1.isNullOrUndefined(this.fieldCheck)) {
                            this.fieldCheck = 2;
                        }
                        else {
                            this.fieldCheck = 0;
                        }
                    }
                    else {
                        if (!ej2_base_1.isNullOrUndefined(this.fieldCheck) && this.fieldCheck !== 0) {
                            blockStyle += this.endTag('a');
                        }
                        this.fieldCheck = 0;
                    }
                }
                else {
                    var text = ej2_base_1.isNullOrUndefined(inline[index_1.textProperty[this.keywordIndex]]) ? '' : inline[index_1.textProperty[this.keywordIndex]];
                    if (inline.hasOwnProperty(index_1.bookmarkTypeProperty[this.keywordIndex])) {
                        switch (inline[index_1.bookmarkTypeProperty[this.keywordIndex]]) {
                            case 0:
                                blockStyle += '<a name=' + inline[index_1.nameProperty[this.keywordIndex]] + '>';
                                break;
                            case 1:
                                blockStyle += '</a>';
                                break;
                        }
                    }
                    Eif (this.fieldCheck === 0) {
                        blockStyle += this.serializeSpan(text, inline[index_1.characterFormatProperty[this.keywordIndex]]);
                    }
                    Iif (this.fieldCheck === 1) {
                        var hyperLink = text.replace(/"/g, '');
                        blockStyle += ' href= \"' + hyperLink.replace('HYPERLINK', '').trim();
                        blockStyle += '\"';
                        blockStyle += '>';
                    }
                    Iif (this.fieldCheck === 2) {
                        blockStyle += this.serializeSpan(text, inline[index_1.characterFormatProperty[this.keywordIndex]]);
                    }
                }
                i++;
            }
            return blockStyle;
        };
        HtmlExport.prototype.serializeContentInlines = function (inline, inlineStyle) {
            inlineStyle = this.serializeInlines(inline, inlineStyle);
            return inlineStyle;
        };
        HtmlExport.prototype.serializeSpan = function (spanText, characterFormat) {
            var spanClass = '';
            Iif (spanText.indexOf('\v') !== -1) {
                spanClass += '<br>';
                return spanClass.toString();
            }
            else Iif (spanText.indexOf('\f') !== -1) {
                spanClass += '<br style = "page-break-after:always;"/>';
                return spanClass.toString();
            }
            var tagAttributes = [];
            this.serializeInlineStyle(characterFormat);
            tagAttributes.push('style="' + this.serializeInlineStyle(characterFormat) + '"');
            spanClass += this.createAttributesTag('span', tagAttributes);
            var text = this.decodeHtmlNames(spanText.toString());
            spanClass += text;
            spanClass += this.endTag('span');
            return spanClass.toString();
        };
        HtmlExport.prototype.getStyleName = function (style) {
            switch (style) {
                case 'Heading 1':
                    return 'h1';
                case 'Heading 2':
                    return 'h2';
                case 'Heading 3':
                    return 'h3';
                case 'Heading 4':
                    return 'h4';
                case 'Heading 5':
                    return 'h5';
                default:
                    return 'p';
            }
        };
        HtmlExport.prototype.serializeImageContainer = function (image) {
            var imageStyle = '';
            var tagAttributes = [];
            this.serializeInlineStyle(image[index_1.characterFormatProperty[this.keywordIndex]]);
            var imageSource = '';
            if (!ej2_base_1.isNullOrUndefined(image[index_1.imageStringProperty[this.keywordIndex]])) {
                var base64ImageString = this.images.get(parseInt(image[index_1.imageStringProperty[this.keywordIndex]]));
                imageSource = base64ImageString[editor_helper_1.HelperMethods.parseBoolValue(image[index_1.isMetaFileProperty[this.keywordIndex]]) ? 1 : 0];
            }
            var width = editor_helper_1.HelperMethods.convertPointToPixel(image[index_1.widthProperty[this.keywordIndex]]);
            var height = editor_helper_1.HelperMethods.convertPointToPixel(image[index_1.heightProperty[this.keywordIndex]]);
            tagAttributes.push('width="' + width.toString() + '"');
            tagAttributes.push('height="' + height.toString() + '"');
            tagAttributes.push('src="' + imageSource + '"');
            imageStyle += this.createAttributesTag('img', tagAttributes);
            imageStyle += (this.endTag('img'));
            return imageStyle.toString();
        };
        HtmlExport.prototype.serializeCell = function (cell, row) {
            var blockStyle = '';
            var tagAttributes = [];
            var cellHtml = '';
            tagAttributes = [];
            Eif (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]])) {
                if (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.shadingProperty[this.keywordIndex]][index_1.backgroundColorProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.shadingProperty[this.keywordIndex]][index_1.backgroundColorProperty[this.keywordIndex]] !== 'empty') {
                    tagAttributes.push('bgcolor="' + editor_helper_1.HelperMethods.getColor(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.shadingProperty[this.keywordIndex]][index_1.backgroundColorProperty[this.keywordIndex]]) + '"');
                }
                Iif (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.columnSpanProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.columnSpanProperty[this.keywordIndex]] > 1) {
                    tagAttributes.push('colspan="' + cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.columnSpanProperty[this.keywordIndex]].toString() + '"');
                }
                Iif (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.rowSpanProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.rowSpanProperty[this.keywordIndex]] > 1) {
                    tagAttributes.push('rowspan="' + cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.rowSpanProperty[this.keywordIndex]].toString() + '"');
                }
                Eif (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.cellWidthProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.cellWidthProperty[this.keywordIndex]] !== 0) {
                    var cellWidth = editor_helper_1.HelperMethods.convertPointToPixel(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.cellWidthProperty[this.keywordIndex]]);
                    tagAttributes.push('width="' + cellWidth.toString() + '"');
                }
                var cellAlignment = ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.verticalAlignmentProperty[this.keywordIndex]]) ? 'top' :
                    this.convertVerticalAlignment(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.verticalAlignmentProperty[this.keywordIndex]]);
                tagAttributes.push('valign="' + cellAlignment + '"');
                if (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.leftMarginProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.leftMarginProperty[this.keywordIndex]] !== 0) {
                    cellHtml += ('padding-left:' + cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.leftMarginProperty[this.keywordIndex]].toString() + 'pt;');
                }
                if (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.rightMarginProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.rightMarginProperty[this.keywordIndex]] !== 0) {
                    cellHtml += ('padding-right:' + cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.rightMarginProperty[this.keywordIndex]].toString() + 'pt;');
                }
                if (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.topMarginProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.topMarginProperty[this.keywordIndex]] !== 0) {
                    cellHtml += ('padding-top:' + cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.topMarginProperty[this.keywordIndex]].toString() + 'pt;');
                }
                if (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.bottomMarginProperty[this.keywordIndex]]) && cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.bottomMarginProperty[this.keywordIndex]] !== 0) {
                    cellHtml += ('padding-bottom:' + cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.bottomMarginProperty[this.keywordIndex]].toString() + 'pt;');
                }
                Eif (!ej2_base_1.isNullOrUndefined(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]])) {
                    cellHtml += this.serializeCellBordersStyle(cell[index_1.cellFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]], row);
                }
            }
            if (cellHtml.length !== 0) {
                tagAttributes.push('style="' + cellHtml + '"');
            }
            blockStyle += (this.createAttributesTag('td', tagAttributes));
            for (var k = 0; k < cell[index_1.blocksProperty[this.keywordIndex]].length; k++) {
                var block = cell[index_1.blocksProperty[this.keywordIndex]][k];
                Iif (block.hasOwnProperty(index_1.rowsProperty[this.keywordIndex])) {
                    blockStyle += this.serializeTable(block);
                }
                else {
                    blockStyle += this.serializeParagraph(block);
                }
            }
            blockStyle += (this.endTag('td'));
            return blockStyle;
        };
        HtmlExport.prototype.convertVerticalAlignment = function (cellVerticalAlignment) {
            switch (cellVerticalAlignment) {
                case 'Center':
                case 1:
                    return 'middle';
                case 'Bottom':
                case 2:
                    return 'bottom';
                default:
                    return 'top';
            }
        };
        HtmlExport.prototype.serializeTable = function (table) {
            var html = '';
            html += this.createTableStartTag(table);
            for (var j = 0; j < table[index_1.rowsProperty[this.keywordIndex]].length; j++) {
                html += this.serializeRow(table[index_1.rowsProperty[this.keywordIndex]][j]);
            }
            html += this.createTableEndTag();
            return html;
        };
        HtmlExport.prototype.serializeRow = function (row) {
            var html = '';
            html += this.createRowStartTag(row);
            for (var k = 0; k < row[index_1.cellsProperty[this.keywordIndex]].length; k++) {
                html += this.serializeCell(row[index_1.cellsProperty[this.keywordIndex]][k], row);
            }
            return html;
        };
        HtmlExport.prototype.serializeParagraphStyle = function (paragraph, className, isList, keywordIndex) {
            var paragraphClass = '';
            var editor;
            Iif (ej2_base_1.isNullOrUndefined(this.keywordIndex)) {
                this.keywordIndex = keywordIndex;
            }
            if (paragraph[index_1.inlinesProperty[this.keywordIndex]].length > 0) {
                paragraphClass += this.serializeCharacterFormat(paragraph[index_1.characterFormatProperty[this.keywordIndex]]);
            }
            var isEmptyLine = false;
            if (paragraph[index_1.inlinesProperty[this.keywordIndex]].length == 0) {
                isEmptyLine = true;
            }
            paragraphClass += this.serializeCharacterFormat(paragraph[index_1.characterFormatProperty[this.keywordIndex]], isEmptyLine);
            paragraphClass += this.serializeParagraphFormat(paragraph[index_1.paragraphFormatProperty[this.keywordIndex]], isList);
            return paragraphClass;
        };
        HtmlExport.prototype.serializeInlineStyle = function (characterFormat) {
            return this.serializeCharacterFormat(characterFormat);
        };
        HtmlExport.prototype.serializeTableBorderStyle = function (borders) {
            var borderStyle = '';
            var border = {};
            border = borders[index_1.leftProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'left');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-left-style:none;');
            }
            border = borders[index_1.topProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'top');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-top-style:none;');
            }
            border = borders[index_1.rightProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'right');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-right-style:none;');
            }
            border = borders[index_1.bottomProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'bottom');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-bottom-style:none;');
            }
            return borderStyle;
        };
        HtmlExport.prototype.serializeCellBordersStyle = function (borders, row) {
            var borderStyle = '';
            var border = {};
            border = borders[index_1.leftProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'left');
            }
            else Iif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-left-style:none;');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.leftProperty[this.keywordIndex]])) {
                border = row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.leftProperty[this.keywordIndex]];
                Iif (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                    border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                    border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                    borderStyle += this.serializeBorderStyle(border, 'left');
                }
            }
            border = borders[index_1.topProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'top');
            }
            else Iif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-top-style:none;');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.topProperty[this.keywordIndex]])) {
                border = row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.topProperty[this.keywordIndex]];
                Iif (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                    border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                    border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                    borderStyle += this.serializeBorderStyle(border, 'top');
                }
            }
            border = borders[index_1.rightProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'right');
            }
            else Iif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-right-style:none;');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.rightProperty[this.keywordIndex]])) {
                border = row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.rightProperty[this.keywordIndex]];
                Iif (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                    border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                    border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                    borderStyle += this.serializeBorderStyle(border, 'right');
                }
            }
            border = borders[index_1.bottomProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                borderStyle += this.serializeBorderStyle(border, 'bottom');
            }
            else Iif (!ej2_base_1.isNullOrUndefined(border) && editor_helper_1.HelperMethods.parseBoolValue(border[index_1.hasNoneStyleProperty[this.keywordIndex]])) {
                borderStyle += ('border-bottom-style:none;');
            }
            else Eif (!ej2_base_1.isNullOrUndefined(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.bottomProperty[this.keywordIndex]])) {
                border = row[index_1.rowFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]][index_1.bottomProperty[this.keywordIndex]];
                Iif (!ej2_base_1.isNullOrUndefined(border) && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 1 : 'None') && border[index_1.lineStyleProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 26 : 'Cleared')) {
                    border[index_1.colorProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]]) ? "#000000" : border[index_1.colorProperty[this.keywordIndex]];
                    border[index_1.lineWidthProperty[this.keywordIndex]] = ej2_base_1.isNullOrUndefined(border[index_1.lineWidthProperty[this.keywordIndex]]) ? 0.5 : border[index_1.lineWidthProperty[this.keywordIndex]];
                    borderStyle += this.serializeBorderStyle(border, 'bottom');
                }
            }
            return borderStyle;
        };
        HtmlExport.prototype.serializeBorderStyle = function (border, borderPosition) {
            var borderStyle = '';
            borderStyle += ('border-' + borderPosition + '-style:' + this.convertBorderLineStyle(border[index_1.lineStyleProperty[this.keywordIndex]]));
            borderStyle += ';';
            Eif (border[index_1.lineWidthProperty[this.keywordIndex]] > 0) {
                borderStyle += ('border-' + borderPosition + '-width:' + border[index_1.lineWidthProperty[this.keywordIndex]].toString() + 'pt;');
            }
            Eif (!ej2_base_1.isNullOrUndefined(border[index_1.colorProperty[this.keywordIndex]])) {
                borderStyle += ('border-' + borderPosition + '-color:' + editor_helper_1.HelperMethods.getColor(border[index_1.colorProperty[this.keywordIndex]]) + ';');
            }
            return borderStyle;
        };
        HtmlExport.prototype.convertBorderLineStyle = function (lineStyle) {
            switch (lineStyle) {
                case 'Single':
                case 0:
                    return 'solid';
                case 'None':
                case 1:
                    return 'none';
                case 'Dot':
                case 2:
                    return 'dotted';
                case 'DashSmallGap':
                case 'DashLargeGap':
                case 'DashDot':
                case 'DashDotDot':
                case 3:
                case 4:
                case 5:
                case 6:
                    return 'dashed';
                case 'Double':
                case 'Triple':
                case 'ThinThickSmallGap':
                case 'ThickThinSmallGap':
                case 'ThinThickThinSmallGap':
                case 'ThinThickMediumGap':
                case 'ThickThinMediumGap':
                case 'ThinThickThinMediumGap':
                case 'ThinThickLargeGap':
                case 'ThickThinLargeGap':
                case 'ThinThickThinLargeGap':
                case 7:
                case 8:
                case 9:
                case 10:
                case 11:
                case 12:
                case 13:
                case 14:
                case 15:
                case 16:
                case 17:
                    return 'double';
                case 'SingleWavy':
                case 18:
                    return 'solid';
                case 'DoubleWavy':
                case 19:
                    return 'double';
                case 'DashDotStroked':
                case 20:
                    return 'solid';
                case 'Emboss3D':
                case 21:
                    return 'ridge';
                case 'Engrave3D':
                case 22:
                    return 'groove';
                case 'Outset':
                case 23:
                    return 'outset';
                case 'Inset':
                case 24:
                    return 'inset';
                default:
                    return 'solid';
            }
        };
        HtmlExport.prototype.serializeCharacterFormat = function (characterFormat, isEmptyLine) {
            if (!ej2_base_1.isNullOrUndefined(characterFormat[index_1.inlineFormatProperty[this.keywordIndex]])) {
                return this.serializeCharacterFormat(characterFormat[index_1.inlineFormatProperty[this.keywordIndex]], isEmptyLine);
            }
            var propertyValue;
            var charStyle = '';
            charStyle += 'font-weight';
            charStyle += ':';
            charStyle += editor_helper_1.HelperMethods.parseBoolValue(characterFormat[index_1.boldProperty[this.keywordIndex]]) ? 'bold' : 'normal';
            charStyle += ';';
            charStyle += 'font-style';
            charStyle += ':';
            Iif (editor_helper_1.HelperMethods.parseBoolValue(characterFormat[index_1.italicProperty[this.keywordIndex]])) {
                charStyle += 'italic';
            }
            else {
                charStyle += 'normal';
            }
            charStyle += ';';
            charStyle += this.serializeTextDecoration(characterFormat);
            if (characterFormat[index_1.baselineAlignmentProperty[this.keywordIndex]] === (this.keywordIndex == 1 ? 1 : 'Superscript') || characterFormat[index_1.baselineAlignmentProperty[this.keywordIndex]] === (this.keywordIndex == 1 ? 2 : 'Subscript')) {
                charStyle += 'vertical-align';
                charStyle += ':';
                charStyle += characterFormat[index_1.baselineAlignmentProperty[this.keywordIndex]] === (this.keywordIndex == 1 ? 1 : 'Superscript') ? 'super' : 'sub';
                charStyle += ';';
            }
            if (!ej2_base_1.isNullOrUndefined(characterFormat[index_1.highlightColorProperty[this.keywordIndex]]) && characterFormat[index_1.highlightColorProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 0 : 'NoColor') && !isEmptyLine) {
                charStyle += 'background-color';
                charStyle += ':';
                charStyle += this.keywordIndex == 1 ? this.getHighlightColorCode(characterFormat[index_1.highlightColorProperty[this.keywordIndex]]) : editor_helper_1.HelperMethods.getHighlightColorCode(characterFormat.highlightColor.toString());
                charStyle += ';';
            }
            propertyValue = characterFormat[index_1.fontColorProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                charStyle += 'color';
                charStyle += ':';
                charStyle += editor_helper_1.HelperMethods.getColor(propertyValue);
                charStyle += ';';
            }
            if (!ej2_base_1.isNullOrUndefined(characterFormat[index_1.allCapsProperty[this.keywordIndex]]) && editor_helper_1.HelperMethods.parseBoolValue(characterFormat[index_1.allCapsProperty[this.keywordIndex]])) {
                charStyle += 'text-transform';
                charStyle += ':';
                charStyle += 'uppercase';
                charStyle += ';';
            }
            propertyValue = characterFormat[index_1.fontSizeProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                charStyle += 'font-size';
                charStyle += ':';
                charStyle += propertyValue.toString();
                charStyle += 'pt';
                charStyle += ';';
            }
            propertyValue = characterFormat[index_1.fontFamilyProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                charStyle += 'font-family';
                charStyle += ':';
                charStyle += propertyValue.toString();
                charStyle += ';';
            }
            propertyValue = characterFormat[index_1.characterSpacingProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                charStyle += 'letter-spacing';
                charStyle += ':';
                charStyle += propertyValue.toString();
                charStyle += 'pt';
                charStyle += ';';
            }
            propertyValue = characterFormat[index_1.scalingProperty[this.keywordIndex]];
            if (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                charStyle += 'transform:scaleX(';
                charStyle += (propertyValue / 100).toString();
                charStyle += ')';
                charStyle += ';';
            }
            return charStyle.toString();
        };
        HtmlExport.prototype.serializeTextDecoration = function (characterFormat) {
            var charStyle = 'text-decoration:';
            var value = '';
            if (characterFormat[index_1.strikethroughProperty[this.keywordIndex]] === (this.keywordIndex == 1 ? 1 : 'SingleStrike') || characterFormat[index_1.strikethroughProperty[this.keywordIndex]] === (this.keywordIndex == 1 ? 2 : 'DoubleStrike')) {
                value += 'line-through ';
            }
            if (!ej2_base_1.isNullOrUndefined(characterFormat[index_1.underlineProperty[this.keywordIndex]]) && characterFormat[index_1.underlineProperty[this.keywordIndex]] !== (this.keywordIndex == 1 ? 0 : 'None')) {
                value += 'underline';
            }
            if (value.length > 1) {
                value = charStyle + value + ';';
            }
            return value;
        };
        HtmlExport.prototype.serializeParagraphFormat = function (paragraphFormat, isList, keywordIndex) {
            Iif (ej2_base_1.isNullOrUndefined(this.keywordIndex)) {
                this.keywordIndex = keywordIndex;
            }
            if (!ej2_base_1.isNullOrUndefined(paragraphFormat[index_1.inlineFormatProperty[this.keywordIndex]])) {
                return this.serializeParagraphFormat(paragraphFormat[index_1.inlineFormatProperty[this.keywordIndex]], isList);
            }
            var propertyValue;
            var paraStyle = '';
            propertyValue = this.getTextAlignment(paragraphFormat[index_1.textAlignmentProperty[this.keywordIndex]]);
            Eif (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                paraStyle += 'text-align:' + propertyValue.toLowerCase() + ';';
            }
            propertyValue = paragraphFormat[index_1.beforeSpacingProperty[this.keywordIndex]];
            Eif (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                paraStyle += 'margin-top:' + propertyValue.toString() + 'pt; ';
            }
            propertyValue = paragraphFormat[index_1.rightIndentProperty[this.keywordIndex]];
            Eif (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                paraStyle += 'margin-right:' + propertyValue.toString() + 'pt; ';
            }
            propertyValue = paragraphFormat[index_1.afterSpacingProperty[this.keywordIndex]];
            Eif (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                paraStyle += 'margin-bottom:' + propertyValue.toString() + 'pt; ';
            }
            propertyValue = paragraphFormat[index_1.leftIndentProperty[this.keywordIndex]];
            if (isList) {
                propertyValue = 0;
            }
            Eif (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                paraStyle += 'margin-left:' + propertyValue.toString() + 'pt; ';
            }
            propertyValue = paragraphFormat[index_1.firstLineIndentProperty[this.keywordIndex]];
            if (isList) {
                propertyValue = 0;
            }
            Iif (!ej2_base_1.isNullOrUndefined(propertyValue) && propertyValue !== 0) {
                paraStyle += 'text-indent:' + propertyValue.toString() + 'pt;';
            }
            Iif (!ej2_base_1.isNullOrUndefined(paragraphFormat[index_1.tabsProperty[this.keywordIndex]]) && paragraphFormat[index_1.tabsProperty[this.keywordIndex]].length > 0) {
                paraStyle += this.serializeTabs(paragraphFormat[index_1.tabsProperty[this.keywordIndex]]);
            }
            propertyValue = paragraphFormat[index_1.lineSpacingProperty[this.keywordIndex]];
            Eif (!ej2_base_1.isNullOrUndefined(propertyValue)) {
                var lineSpacingType = paragraphFormat[index_1.lineSpacingTypeProperty[this.keywordIndex]];
                var isMultiple = lineSpacingType === (this.keywordIndex == 1 ? 0 : 'Multiple');
                var isAtLeast = lineSpacingType === (this.keywordIndex == 1 ? 0 : 'AtLeast');
                if (propertyValue == 1 && isMultiple) {
                    paraStyle += 'line-height:' + 'normal;';
                }
                else if (isMultiple) {
                    paraStyle += 'line-height:' + (Math.abs(propertyValue) * 100).toString() + '%;';
                }
                else Eif (!isAtLeast || propertyValue >= 12) {
                    paraStyle += 'line-height:' + propertyValue.toString() + 'pt;';
                }
            }
            return paraStyle.toString();
        };
        HtmlExport.prototype.serializeTabs = function (tabs) {
            var tabsStyle = 'tab-stops:';
            for (var i = 0; i < tabs.length; i++) {
                var tab = tabs[i];
                if (tab.hasOwnProperty(index_1.tabJustificationProperty[this.keywordIndex])) {
                    var tabJustification = this.getTabJustification(tab[index_1.tabJustificationProperty[this.keywordIndex]]);
                    if (tabJustification !== '') {
                        tabsStyle += tabJustification + ' ';
                    }
                }
                if (tab.hasOwnProperty(index_1.tabLeaderProperty[this.keywordIndex])) {
                    var tabLeader = this.getTabLeader(tab[index_1.tabLeaderProperty[this.keywordIndex]]);
                    if (tabLeader !== '') {
                        tabsStyle += tabLeader + ' ';
                    }
                }
                if (tab.hasOwnProperty(index_1.positionProperty[this.keywordIndex])) {
                    tabsStyle += tab[index_1.positionProperty[this.keywordIndex]].toString() + 'pt';
                }
                if (i !== tabs.length - 1) {
                    tabsStyle += ' ';
                }
            }
            tabsStyle += ';';
            return tabsStyle;
        };
        HtmlExport.prototype.getTabLeader = function (tabLeader) {
            switch (tabLeader) {
                case 'Dot':
                case 2:
                    return 'dotted';
                case 'Hyphen':
                case 3:
                    return 'dashed';
                case 'Underscore':
                case 4:
                    return 'heavy';
                default:
                    return '';
            }
        };
        HtmlExport.prototype.getTabJustification = function (tabJustification) {
            switch (tabJustification) {
                case 'Bar':
                case 1:
                    return 'bar';
                case 'Center':
                case 2:
                    return 'center';
                case 'Decimal':
                case 3:
                    return 'decimal';
                case 'Right':
                case 5:
                    return 'right';
                default:
                    return '';
            }
        };
        HtmlExport.prototype.createAttributesTag = function (tagValue, localProperties) {
            var sb = '';
            sb += '<';
            sb += tagValue;
            for (var i = 0; i < localProperties.length; i++) {
                sb += ' ';
                sb += localProperties[i];
            }
            Eif (tagValue !== 'a') {
                sb += '>';
            }
            return sb;
        };
        HtmlExport.prototype.createTag = function (tagValue) {
            var s = '';
            s += '<';
            s += tagValue;
            s += '>';
            return s;
        };
        HtmlExport.prototype.endTag = function (tagValue) {
            var sb = '';
            sb += '<';
            sb += '/';
            sb += tagValue;
            sb += '>';
            return sb;
        };
        HtmlExport.prototype.createTableStartTag = function (table) {
            var blockStyle = '';
            var tableStyle = '';
            var tagAttributes = [];
            Eif (!ej2_base_1.isNullOrUndefined(table[index_1.tableFormatProperty[this.keywordIndex]])) {
                if (!ej2_base_1.isNullOrUndefined(table[index_1.tableFormatProperty[this.keywordIndex]][index_1.shadingProperty[this.keywordIndex]]) && !ej2_base_1.isNullOrUndefined(table[index_1.tableFormatProperty[this.keywordIndex]][index_1.shadingProperty[this.keywordIndex]][index_1.backgroundColorProperty[this.keywordIndex]]) && table[index_1.tableFormatProperty[this.keywordIndex]][index_1.shadingProperty[this.keywordIndex]][index_1.backgroundColorProperty[this.keywordIndex]] !== 'empty') {
                    tagAttributes.push('bgcolor="' + editor_helper_1.HelperMethods.getColor(table[index_1.tableFormatProperty[this.keywordIndex]][index_1.shadingProperty[this.keywordIndex]][index_1.backgroundColorProperty[this.keywordIndex]]) + '"');
                }
                if (!ej2_base_1.isNullOrUndefined(table[index_1.tableFormatProperty[this.keywordIndex]][index_1.cellSpacingProperty[this.keywordIndex]]) && table[index_1.tableFormatProperty[this.keywordIndex]][index_1.cellSpacingProperty[this.keywordIndex]] > 0) {
                    tagAttributes.push('cellspacing="' + (((table[index_1.tableFormatProperty[this.keywordIndex]][index_1.cellSpacingProperty[this.keywordIndex]] * 72) / 96) * 2).toString() + '"');
                }
                else {
                    tableStyle += ('border-collapse:collapse;');
                }
                tagAttributes.push('cellpadding="' + '0"');
                Iif (!ej2_base_1.isNullOrUndefined(table[index_1.titleProperty[this.keywordIndex]])) {
                    tagAttributes.push('title="' + table[index_1.titleProperty[this.keywordIndex]] + '"');
                }
                Iif (!ej2_base_1.isNullOrUndefined(table[index_1.descriptionProperty[this.keywordIndex]])) {
                    tagAttributes.push('summary="' + table[index_1.descriptionProperty[this.keywordIndex]] + '"');
                }
                Iif (!ej2_base_1.isNullOrUndefined(table[index_1.tableFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]]) && table[index_1.tableFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]] !== 0 &&
                    table[index_1.tableFormatProperty[this.keywordIndex]][index_1.tableAlignmentProperty[this.keywordIndex]] === (this.keywordIndex == 1 ? 0 : 'Left')) {
                    tableStyle += 'margin-left:' + (table[index_1.tableFormatProperty[this.keywordIndex]][index_1.leftIndentProperty[this.keywordIndex]].toString() + 'pt;');
                }
                Eif (!ej2_base_1.isNullOrUndefined(table[index_1.tableFormatProperty[this.keywordIndex]])) {
                    tableStyle += this.serializeTableWidth(table[index_1.tableFormatProperty[this.keywordIndex]]);
                }
                Eif (!ej2_base_1.isNullOrUndefined(table[index_1.tableFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]])) {
                    tableStyle += this.serializeTableBorderStyle(table[index_1.tableFormatProperty[this.keywordIndex]][index_1.bordersProperty[this.keywordIndex]]);
                }
            }
            Eif (tableStyle.length !== 0) {
                tagAttributes.push('style="', tableStyle.toString() + '"');
            }
            return blockStyle += (this.createAttributesTag('table', tagAttributes));
        };
        HtmlExport.prototype.serializeTableWidth = function (tableFormat) {
            var width = '';
            switch (tableFormat[index_1.preferredWidthTypeProperty[this.keywordIndex]]) {
                case 'Percent':
                case 1:
                    width += 'width: ' + tableFormat[index_1.preferredWidthProperty[this.keywordIndex]].toString() + '%;';
                    break;
                case 'Point':
                case 2:
                    width += 'width: ' + tableFormat[index_1.preferredWidthProperty[this.keywordIndex]].toString() + 'pt;';
                    break;
                case 'Auto':
                case 0:
                    width += 'width: auto;';
                    break;
            }
            return width;
        };
        HtmlExport.prototype.getHighlightColorCode = function (highlightColor) {
            var color = '#ffffff';
            switch (highlightColor) {
                case 1:
                    color = '#ffff00';
                    break;
                case 2:
                    color = '#00ff00';
                    break;
                case 3:
                    color = '#00ffff';
                    break;
                case 4:
                    color = '#ff00ff';
                    break;
                case 5:
                    color = '#0000ff';
                    break;
                case 6:
                    color = '#ff0000';
                    break;
                case 7:
                    color = '#000080';
                    break;
                case 8:
                    color = '#008080';
                    break;
                case 9:
                    color = '#008000';
                    break;
                case 10:
                    color = '#800080';
                    break;
                case 11:
                    color = '#800000';
                    break;
                case 12:
                    color = '#808000';
                    break;
                case 13:
                    color = '#808080';
                    break;
                case 14:
                    color = '#c0c0c0';
                    break;
                case 15:
                    color = '#000000';
                    break;
            }
            return color;
        };
        HtmlExport.prototype.getTextAlignment = function (textAlignment) {
            switch (textAlignment) {
                case 1:
                    return 'Center';
                case 2:
                    return 'Right';
                case 3:
                    return 'Justify';
                default:
                    return 'Left';
            }
        };
        HtmlExport.prototype.createTableEndTag = function () {
            var blockStyle = '';
            blockStyle += (this.endTag('table'));
            return blockStyle;
        };
        HtmlExport.prototype.createRowStartTag = function (row) {
            var blockStyle = '';
            var tagAttributes = [];
            if (editor_helper_1.HelperMethods.parseBoolValue(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.isHeaderProperty[this.keywordIndex]])) {
                blockStyle += (this.createTag('thead'));
            }
            Eif (!ej2_base_1.isNullOrUndefined(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.heightProperty[this.keywordIndex]]) && row[index_1.rowFormatProperty[this.keywordIndex]][index_1.heightProperty[this.keywordIndex]] > 0) {
                var height = editor_helper_1.HelperMethods.convertPointToPixel(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.heightProperty[this.keywordIndex]]);
                tagAttributes.push('height="' + height + '"');
            }
            return blockStyle + this.createAttributesTag('tr', tagAttributes);
        };
        HtmlExport.prototype.createRowEndTag = function (row) {
            var blockStyle = '';
            blockStyle += (this.endTag('tr'));
            if (editor_helper_1.HelperMethods.parseBoolValue(row[index_1.rowFormatProperty[this.keywordIndex]][index_1.isHeaderProperty[this.keywordIndex]])) {
                blockStyle += (this.endTag('thead'));
            }
            return blockStyle;
        };
        HtmlExport.prototype.decodeHtmlNames = function (text) {
            Iif (text === '\t') {
                return '&emsp;';
            }
            text = text.replace(/</g, '&lt;').replace(/>/g, '&gt;');
            var splittedText = text.split(' ');
            var htmlText = '';
            Eif (splittedText.length > 0) {
                htmlText = splittedText[0];
                for (var i = 0; i < splittedText.length - 1; i++) {
                    htmlText += ' ' + splittedText[i + 1];
                }
            }
            return htmlText;
        };
        return HtmlExport;
    }());
    exports.HtmlExport = HtmlExport;
});