Skip to Content

How do you download the screen to an excel getting the style and the configuration utf8?

I have this code in sapui5 part js:

onExcel: function(oEvent) { //table

this.capturar_vistal();

var tmpElemento = document.createElement("a");

var data_type = "data:application/vnd.ms-excel";

var tabla_div = document.getElementById(idTable).innerHTML;

var tabla_html = tabla_div.replace(/ /g, "%20");

tmpElemento.href = data_type + ", " + tabla_html; //Asignamos el nombre a nuestro EXCEL tmpElemento.download = "tabla.xls";

tmpElemento.click(); },

capturar_vista: function() {

var vista = sap.ui.getCore().byId($(".vista0")[0].id + "--innerApp");

/*Capturamos la url para saber en que vista nos encontramos*/

var URLactual = window.location; str = "";

if (URLactual.hash.indexOf("/") !== -1) {

str = URLactual.hash.substr(URLactual.hash.indexOf("/") + 1, URLactual.hash.lenght);

}

if (str === "" || str === "undefined") {

str = "expediente";

} /*Definimos una variable con la tabla de la vista en la que nos encontramos */

for (i = 0; i < vista.mAggregations.pages.length; i++) {

if (vista.mAggregations.pages[i].mProperties.viewName == "preparacion_cdci.view." + str) {

tabla = vista.mAggregations.pages[i].mAggregations.content[1].mAggregations.content[0]; idTable = tabla.sId; } } },

with this code I can download as an excel but it daesn't take the css & the utf8

What I need to do?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers