Generacion de Archivos con Nombre (Matriz o Foro )

git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C222
This commit is contained in:
dmendez 2018-07-12 21:00:21 +00:00
parent c4f1e98491
commit 52f39eb548

View file

@ -1782,4 +1782,41 @@ this.ValidarAcceder = function (vista, controlador,opcion) {
} else {
toastr.warning('No tiene permisos para ejecutar esta opción', Message_Warning);
}
}
}
this.ExportarAMsWord = function (html, filename) {
var blob = new Blob(['\ufeff', html], {
type: 'application/msword'
});
// Specify link url
//var url = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(html);
var url = 'data:application/vnd.ms-word;charset=utf-8,' + encodeURIComponent(html);
// Specify file name
filename = filename ? filename + '.doc' : 'document.doc';
// Create download link element
var downloadLink = document.createElement("a");
document.body.appendChild(downloadLink);
if (navigator.msSaveOrOpenBlob) {
navigator.msSaveOrOpenBlob(blob, filename);
} else {
// Create a link to the file
downloadLink.href = url;
// Setting the file name
downloadLink.download = filename;
//triggering the function
downloadLink.click();
}
document.body.removeChild(downloadLink);
}