Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: office-viewer excel 去掉字母间距导致显示不正确问题 #9853

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/amis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"moment": "^2.19.4",
"moment-timezone": "^0.5.34",
"mpegts.js": "^1.6.10",
"office-viewer": "^0.3.7",
"office-viewer": "^0.3.8",
"prop-types": "^15.6.1",
"qrcode.react": "^3.1.0",
"react-cropper": "^2.1.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/office-viewer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "office-viewer",
"version": "0.3.7",
"version": "0.3.8",
"description": "office 文档在线预览",
"main": "lib/index.js",
"module": "esm/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export function drawMultiLineText(

const defaultFontHeight = dataProvider.getDefaultFontSize().height;

const latterSpace = defaultFontHeight * 0.1;

const textPositions: Rect[] = [];

const totalLineHeight = lines.reduce((acc, line) => {
Expand All @@ -65,9 +63,6 @@ export function drawMultiLineText(
return acc + (token.w || 0);
}, 0);

// 加上字母间距
totalLineWidth += latterSpace * (tokens.length - 1);

if (horizontal === 'center') {
currentX = x + (width - totalLineWidth) / 2;
} else if (horizontal === 'right') {
Expand Down Expand Up @@ -97,7 +92,7 @@ export function drawMultiLineText(
height: fontHeight
});
// 这里其实不大可能为零
currentX = currentX + (token.w || 0) + latterSpace;
currentX = currentX + (token.w || 0);
}
const lineHeight = line.maxHeight || defaultFontHeight;
textHeight += lineHeight;
Expand Down
Loading