office-viewer 0.3.7 → 0.3.9
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.
|
@@ -9,7 +9,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
9
9
|
// 这样才能让不同字体大小的文字垂直对齐
|
|
10
10
|
ctx.textBaseline = 'alphabetic';
|
|
11
11
|
var defaultFontHeight = dataProvider.getDefaultFontSize().height;
|
|
12
|
-
var latterSpace = defaultFontHeight * 0.1;
|
|
13
12
|
var textPositions = [];
|
|
14
13
|
var totalLineHeight = lines.reduce(function (acc, line) {
|
|
15
14
|
return acc + (line.maxHeight || defaultFontHeight);
|
|
@@ -36,8 +35,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
36
35
|
var totalLineWidth = tokens.reduce(function (acc, token) {
|
|
37
36
|
return acc + (token.w || 0);
|
|
38
37
|
}, 0);
|
|
39
|
-
// 加上字母间距
|
|
40
|
-
totalLineWidth += latterSpace * (tokens.length - 1);
|
|
41
38
|
if (horizontal === 'center') {
|
|
42
39
|
currentX = x + (width - totalLineWidth) / 2;
|
|
43
40
|
}
|
|
@@ -67,7 +64,7 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
67
64
|
height: fontHeight
|
|
68
65
|
});
|
|
69
66
|
// 这里其实不大可能为零
|
|
70
|
-
currentX = currentX + (token.w || 0)
|
|
67
|
+
currentX = currentX + (token.w || 0);
|
|
71
68
|
}
|
|
72
69
|
}
|
|
73
70
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -114,7 +114,7 @@ function getViewPointData(getSheetRowData, getMergeCells, getRowHeight, getColWi
|
|
|
114
114
|
for (var i = startRow; i < rowIndex; i++) {
|
|
115
115
|
yOffset += getRowHeight(i);
|
|
116
116
|
}
|
|
117
|
-
y
|
|
117
|
+
y -= yOffset;
|
|
118
118
|
var value_1 = getSheetRowData(startRow)[startCol];
|
|
119
119
|
displayData.push({
|
|
120
120
|
x: x,
|
|
@@ -13,7 +13,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
13
13
|
// 这样才能让不同字体大小的文字垂直对齐
|
|
14
14
|
ctx.textBaseline = 'alphabetic';
|
|
15
15
|
var defaultFontHeight = dataProvider.getDefaultFontSize().height;
|
|
16
|
-
var latterSpace = defaultFontHeight * 0.1;
|
|
17
16
|
var textPositions = [];
|
|
18
17
|
var totalLineHeight = lines.reduce(function (acc, line) {
|
|
19
18
|
return acc + (line.maxHeight || defaultFontHeight);
|
|
@@ -40,8 +39,6 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
40
39
|
var totalLineWidth = tokens.reduce(function (acc, token) {
|
|
41
40
|
return acc + (token.w || 0);
|
|
42
41
|
}, 0);
|
|
43
|
-
// 加上字母间距
|
|
44
|
-
totalLineWidth += latterSpace * (tokens.length - 1);
|
|
45
42
|
if (horizontal === 'center') {
|
|
46
43
|
currentX = x + (width - totalLineWidth) / 2;
|
|
47
44
|
}
|
|
@@ -71,7 +68,7 @@ function drawMultiLineText(excelRender, sheet, ctx, dataProvider, fontStyle, lin
|
|
|
71
68
|
height: fontHeight
|
|
72
69
|
});
|
|
73
70
|
// 这里其实不大可能为零
|
|
74
|
-
currentX = currentX + (token.w || 0)
|
|
71
|
+
currentX = currentX + (token.w || 0);
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
74
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
@@ -118,7 +118,7 @@ function getViewPointData(getSheetRowData, getMergeCells, getRowHeight, getColWi
|
|
|
118
118
|
for (var i = startRow; i < rowIndex; i++) {
|
|
119
119
|
yOffset += getRowHeight(i);
|
|
120
120
|
}
|
|
121
|
-
y
|
|
121
|
+
y -= yOffset;
|
|
122
122
|
var value_1 = getSheetRowData(startRow)[startCol];
|
|
123
123
|
displayData.push({
|
|
124
124
|
x: x,
|