intelica-library-ui 0.1.88 → 0.1.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2802,8 +2802,8 @@ class HtmlToExcelService {
|
|
|
2802
2802
|
const groupedIndices = new Set();
|
|
2803
2803
|
if (headerGroups.length > 0) {
|
|
2804
2804
|
for (const group of headerGroups) {
|
|
2805
|
-
const startChar = this.
|
|
2806
|
-
const endChar = this.
|
|
2805
|
+
const startChar = this.GetExcelColumnLetter(group.startColumn);
|
|
2806
|
+
const endChar = this.GetExcelColumnLetter(group.endColumn);
|
|
2807
2807
|
const range = `${startChar}${startRow}:${endChar}${startRow}`;
|
|
2808
2808
|
worksheet.mergeCells(range);
|
|
2809
2809
|
const cellGroup = `${startChar}${startRow}`;
|
|
@@ -2831,7 +2831,7 @@ class HtmlToExcelService {
|
|
|
2831
2831
|
}
|
|
2832
2832
|
}
|
|
2833
2833
|
for (let i = 0; i < columns.length; i++) {
|
|
2834
|
-
const colLetter = this.
|
|
2834
|
+
const colLetter = this.GetExcelColumnLetter(i);
|
|
2835
2835
|
const topCell = `${colLetter}${startRow}`;
|
|
2836
2836
|
const bottomCell = `${colLetter}${startRow + 1}`;
|
|
2837
2837
|
if (groupedIndices.has(i)) {
|
|
@@ -2889,7 +2889,7 @@ class HtmlToExcelService {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
});
|
|
2891
2891
|
columns.forEach((col, index) => {
|
|
2892
|
-
const cellAddress = `${this.
|
|
2892
|
+
const cellAddress = `${this.GetExcelColumnLetter(index)}${startRow}`;
|
|
2893
2893
|
const cell = worksheet.getCell(cellAddress);
|
|
2894
2894
|
cell.font = {
|
|
2895
2895
|
name: "Arial",
|
|
@@ -2911,7 +2911,6 @@ class HtmlToExcelService {
|
|
|
2911
2911
|
for (let colIndex = 0; colIndex < columns.length; colIndex++) {
|
|
2912
2912
|
rowValues.push(colIndex === 0 ? `${rowIndex + 1}` : rows[rowIndex][columns[colIndex].columnName] ?? "");
|
|
2913
2913
|
}
|
|
2914
|
-
console.log(rowValues);
|
|
2915
2914
|
const insertedRow = worksheet.addRow(rowValues);
|
|
2916
2915
|
insertedRow.eachCell((cell, colNumber) => {
|
|
2917
2916
|
const col = columns[colNumber - 1];
|
|
@@ -2967,7 +2966,7 @@ class HtmlToExcelService {
|
|
|
2967
2966
|
});
|
|
2968
2967
|
//Subtitulos: Se inserta al final para evitar altere el autoajuste de las columnas
|
|
2969
2968
|
for (let i = 0; i < subtitles.length; i++) {
|
|
2970
|
-
const range = `A${6 + i}:${this.
|
|
2969
|
+
const range = `A${6 + i}:${this.GetExcelColumnLetter(columns.length - 1)}${6 + i}`;
|
|
2971
2970
|
worksheet.mergeCells(range);
|
|
2972
2971
|
const cell = worksheet.getCell(`A${6 + i}`);
|
|
2973
2972
|
cell.value = subtitles[i];
|
|
@@ -3034,7 +3033,7 @@ class HtmlToExcelService {
|
|
|
3034
3033
|
return;
|
|
3035
3034
|
if (columns[index] == undefined)
|
|
3036
3035
|
return;
|
|
3037
|
-
let columnWidth = columns[index].width ?? Math.max(...column.values.map(v => (v ? v.toString().length : 0)).filter(v => typeof v === "number"), columns[index].displayColumnName.length) * 1.
|
|
3036
|
+
let columnWidth = columns[index].width ?? Math.max(...column.values.map(v => (v ? v.toString().length : 0)).filter(v => typeof v === "number"), columns[index].displayColumnName.length) * 1.4;
|
|
3038
3037
|
column.width = Math.min(Math.max(columnWidth, 5), 100);
|
|
3039
3038
|
});
|
|
3040
3039
|
worksheet.eachRow((row, rowIndex) => {
|
|
@@ -3060,7 +3059,7 @@ class HtmlToExcelService {
|
|
|
3060
3059
|
worksheet.views = [{ showGridLines: false }];
|
|
3061
3060
|
const allColumns = orderColumn ? [{ displayColumnName: "N°" }, ...columns] : columns;
|
|
3062
3061
|
allColumns.forEach((col, index) => {
|
|
3063
|
-
const columnLetter = this.
|
|
3062
|
+
const columnLetter = this.GetExcelColumnLetter(index);
|
|
3064
3063
|
const headerCell = worksheet.getCell(`${columnLetter}1`);
|
|
3065
3064
|
headerCell.value = col.displayColumnName;
|
|
3066
3065
|
headerCell.alignment = { horizontal: "center", vertical: "middle" };
|
|
@@ -3094,7 +3093,7 @@ class HtmlToExcelService {
|
|
|
3094
3093
|
const buffer = await workbook.xlsx.writeBuffer();
|
|
3095
3094
|
saveAs(new Blob([buffer]), excelName);
|
|
3096
3095
|
}
|
|
3097
|
-
|
|
3096
|
+
GetExcelColumnLetter(columnNumber) {
|
|
3098
3097
|
let letter = "";
|
|
3099
3098
|
while (columnNumber >= 0) {
|
|
3100
3099
|
letter = String.fromCharCode(65 + (columnNumber % 26)) + letter;
|