html - 如何使用具有相同样式和字体的apache POI在网页中显示excel表?
问题描述
我尝试使用RichTextString
来获取单个字符的字体,但它仅适用于应用了至少一种不同样式的单元格。在整个单元格中应用相同样式的情况下:
font1 = workbook.getFontAt(richString.getFontAtIndex(i))
在这里,richString.getFontAtIndex(i)
返回 0,因此整个字体对象变为空。
解决方案
if(richString.getFontAtIndex(i)==0){
font = workbook.getFontAt(cs.getFontIndex());
font1 = workbook.getFontAt(cs.getFontIndex());
} else {
font = workbook.getFontAt(richString.getFontAtIndex(i))
font1 = workbook.getFontAt(richString.getFontAtIndex(i))
}
推荐阅读
- python-3.x - 我希望我的缺失数据取我缺失数据的平均值
- javascript - Antd 的@Form.create
() 装饰器导致模棱两可的 TypeScript 错误 - xamarin - 如何使用 TabbedPage.ToolbarPlacement="Bottom" - Xamarin Forms 实现 TabLayout.IOnTabSelectedListener.OnTabUnselected?
- c# - 在 64 位中使用 NTwain nuget 包
- php - 谷歌浏览器收藏图标,不使用 Wordpress 显示
- ckeditor5 - 如何在CKEditor5中自动创建粘贴图像之间的空间?
- java - Spring Boot 上的基本放置(更新)
- twitter-bootstrap-3 - 隐藏小型设备的列
- java - 尽管对可执行 jar 使用清单文件,但我不断收到“无法找到或加载主类”错误
- javascript - 使用javascript检查asp.net mvc核心和C#中的进程状态