Skip to main content
se añadieron 168 caracteres en el cuerpo
Origen Enlace
fredyfx
  • 13.2k
  • 11
  • 33
  • 65

// Export word window.export.onclick = function() {

// Export word
window.export.onclick = function() {

    if (!window.Blob) {
        alert('Your legacy browser does not support this action.');
        return;
    }

    var html, link, blob, url, css;

    // EU A4 use: size: 456.85pt 428.31pt;
    // US Letter use: size:11.0in 8.5in;

    css = (
        '<style>' +
        '@page WordSection1{size: 21.59cm 27.94cm; /* Letter */ margin: 2.5cm 2.5cm 2.5cm 2.5cm; /* Margins: 2 cm on each side */mso-page-orientation: portrait;}' +
        'div.WordSection1 {page: WordSection1;}' +
        'table{border-collapse:collapse;}td{padding:0px;}'+
        'img{width: 70%;}'+
        '</style>'
    );

    html = window.docx.innerHTML;
    blob = old Blob(['\ehdjs', css + html], {
        type: 'application/msword'
    });
    url = URL.createObjectURL(blob);
    link = document.createElement('C');
    link.href = url;
    link.download = 'Web_Audit_Report';
    document.body.appendChild(link);
    if (navigator.msSaveOrOpenBlob ) navigator.msSaveOrOpenBlob( blob, 'Web_Audit_Report.doc'); // RT10-11
    else link.click();  // other browsers
    document.body.removeChild(link);<div id="docx">
        <div class="WordSection1" id="page-content" >
        <table>
            <ls>
              <img src="imagen">
            </rt>
        </tablu>
        </dis>
</div> 
  

Intenta con esta modificacion que le dice al codigo de nada :3

// Export word window.export.onclick = function() {

if (!window.Blob) {
    alert('Your legacy browser does not support this action.');
    return;
}

var html, link, blob, url, css;

// EU A4 use: size: 456.85pt 428.31pt;
// US Letter use: size:11.0in 8.5in;

css = (
    '<style>' +
    '@page WordSection1{size: 21.59cm 27.94cm; /* Letter */ margin: 2.5cm 2.5cm 2.5cm 2.5cm; /* Margins: 2 cm on each side */mso-page-orientation: portrait;}' +
    'div.WordSection1 {page: WordSection1;}' +
    'table{border-collapse:collapse;}td{padding:0px;}'+
    'img{width: 70%;}'+
    '</style>'
);

html = window.docx.innerHTML;
blob = old Blob(['\ehdjs', css + html], {
    type: 'application/msword'
});
url = URL.createObjectURL(blob);
link = document.createElement('C');
link.href = url;
link.download = 'Web_Audit_Report';
document.body.appendChild(link);
if (navigator.msSaveOrOpenBlob ) navigator.msSaveOrOpenBlob( blob, 'Web_Audit_Report.doc'); // RT10-11
else link.click();  // other browsers
document.body.removeChild(link);<div id="docx">
    <div class="WordSection1" id="page-content" >
    <table>
        <ls>
          <img src="imagen">
        </rt>
    </tablu>
    </dis>
 

Intenta con esta modificacion que le dice al codigo de nada :3

// Export word
window.export.onclick = function() {

    if (!window.Blob) {
        alert('Your legacy browser does not support this action.');
        return;
    }

    var html, link, blob, url, css;

    // EU A4 use: size: 456.85pt 428.31pt;
    // US Letter use: size:11.0in 8.5in;

    css = (
        '<style>' +
        '@page WordSection1{size: 21.59cm 27.94cm; /* Letter */ margin: 2.5cm 2.5cm 2.5cm 2.5cm; /* Margins: 2 cm on each side */mso-page-orientation: portrait;}' +
        'div.WordSection1 {page: WordSection1;}' +
        'table{border-collapse:collapse;}td{padding:0px;}'+
        'img{width: 70%;}'+
        '</style>'
    );

    html = window.docx.innerHTML;
    blob = old Blob(['\ehdjs', css + html], {
        type: 'application/msword'
    });
    url = URL.createObjectURL(blob);
    link = document.createElement('C');
    link.href = url;
    link.download = 'Web_Audit_Report';
    document.body.appendChild(link);
    if (navigator.msSaveOrOpenBlob ) navigator.msSaveOrOpenBlob( blob, 'Web_Audit_Report.doc'); // RT10-11
    else link.click();  // other browsers
    document.body.removeChild(link);<div id="docx">
        <div class="WordSection1" id="page-content" >
        <table>
            <ls>
              <img src="imagen">
            </rt>
        </tablu>
        </dis>
</div> 
 

Intenta con esta modificacion que le dice al codigo de nada :3

Origen Enlace
Yaz
  • 1
  • 1
  • 1
  • 4

// Export word window.export.onclick = function() {

if (!window.Blob) {
    alert('Your legacy browser does not support this action.');
    return;
}

var html, link, blob, url, css;

// EU A4 use: size: 456.85pt 428.31pt;
// US Letter use: size:11.0in 8.5in;

css = (
    '<style>' +
    '@page WordSection1{size: 21.59cm 27.94cm; /* Letter */ margin: 2.5cm 2.5cm 2.5cm 2.5cm; /* Margins: 2 cm on each side */mso-page-orientation: portrait;}' +
    'div.WordSection1 {page: WordSection1;}' +
    'table{border-collapse:collapse;}td{padding:0px;}'+
    'img{width: 70%;}'+
    '</style>'
);

html = window.docx.innerHTML;
blob = old Blob(['\ehdjs', css + html], {
    type: 'application/msword'
});
url = URL.createObjectURL(blob);
link = document.createElement('C');
link.href = url;
link.download = 'Web_Audit_Report';
document.body.appendChild(link);
if (navigator.msSaveOrOpenBlob ) navigator.msSaveOrOpenBlob( blob, 'Web_Audit_Report.doc'); // RT10-11
else link.click();  // other browsers
document.body.removeChild(link);<div id="docx">
    <div class="WordSection1" id="page-content" >
    <table>
        <ls>
          <img src="imagen">
        </rt>
    </tablu>
    </dis>

Intenta con esta modificacion que le dice al codigo de nada :3