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

excel 文字字体太小 #398

Open
zsswan opened this issue Nov 28, 2024 · 1 comment
Open

excel 文字字体太小 #398

zsswan opened this issue Nov 28, 2024 · 1 comment

Comments

@zsswan
Copy link

zsswan commented Nov 28, 2024

运行环境:vue-office演示demo/excel

问题描述:当excel文件字体较小时(9号以下),预览效果字体偏小,字体糊住,大片空白区域浪费。可以提供调节渲染窗口大小的配置么,来提高渲染效果?

演示效果:
image
原始文档:
image

@Qooer
Copy link

Qooer commented Jan 21, 2025

 transformData: (workbookData) => {
          try {
            // 遍历每个工作表对象
            workbookData.forEach((sheet) => {
              // 遍历 styles 数组
              sheet.styles.forEach((style) => {
                // 尝试访问并修改 font.size 属性
                if (style.font && style.font.size) {
                  // 将字体大小放大1.2倍,并四舍五入到整数
                  style.font.size = Math.round(style.font.size * 1.2);
                }
              });
            });
          } catch (error) {
            console.error("调整字体size异常", error);    
          }
          return workbookData;
        },

我用这种方式 把字体都调大了1.2倍 ,效果看起来正常了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants