- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我使用 Apache POI 3.15。我最近切换到最新版本,我们现在有一些已弃用的方法,它们具有“短”边框样式、“短”对齐...对于这些已弃用的方法,我们有带有 Enum 参数的新方法(如 BorderStyle、HorizontalAlignment、FillPatternType...)。这对我来说没问题。
现在,我还使用 RegionUtil 为合并区域放置一些样式。但是 RegionUtil 似乎使用旧的“短”样式。
这是我的代码(灵感来自 https://stackoverflow.com/a/23619827/502040 但没有使用弃用的方法):
protected static void addMergedRegion(Sheet sheet, int iRowMin, int iRowMax, int iColMin, int iColMax) {
CellRangeAddress cellZone = new CellRangeAddress(iRowMin, iRowMax, iColMin, iColMax);
sheet.addMergedRegion(cellZone);
Cell cell = sheet.getRow(iRowMin).getCell(iColMin);
if (cell != null) {
RegionUtil.setBorderBottom(cell.getCellStyle().getBorderBottomEnum().getCode(), cellZone, sheet);
RegionUtil.setBorderTop(cell.getCellStyle().getBorderTopEnum().getCode(), cellZone, sheet);
RegionUtil.setBorderLeft(cell.getCellStyle().getBorderLeftEnum().getCode(), cellZone, sheet);
RegionUtil.setBorderRight(cell.getCellStyle().getBorderRightEnum().getCode(), cellZone, sheet);
RegionUtil.setBottomBorderColor(cell.getCellStyle().getBottomBorderColor(), cellZone, sheet);
RegionUtil.setTopBorderColor(cell.getCellStyle().getTopBorderColor(), cellZone, sheet);
RegionUtil.setLeftBorderColor(cell.getCellStyle().getLeftBorderColor(), cellZone, sheet);
RegionUtil.setRightBorderColor(cell.getCellStyle().getRightBorderColor(), cellZone, sheet);
}
}
但是我在我的日志中发现了一些像这样的行:
BorderStyle short usage
我在类 CellUtil 中找到了这条线的起源:
private static BorderStyle getBorderStyle(Map<String, Object> properties, String name) {
Object value = properties.get(name);
BorderStyle border;
if (value instanceof BorderStyle) {
border = (BorderStyle) value;
}
// @deprecated 3.15 beta 2. getBorderStyle will only work on BorderStyle enums instead of codes in the future.
else if (value instanceof Short) {
if (log.check(POILogger.WARN)) {
log.log(POILogger.WARN, "Deprecation warning: CellUtil properties map uses Short values for "
+ name + ". Should use BorderStyle enums instead.");
}
System.out.println("BorderStyle short usage");
short code = ((Short) value).shortValue();
border = BorderStyle.valueOf(code);
}
else if (value == null) {
border = BorderStyle.NONE;
}
else {
throw new RuntimeException("Unexpected border style class. Must be BorderStyle or Short (deprecated).");
}
return border;
}
您是否有使用枚举样式为合并区域制作边框的解决方案?
最佳答案
您需要使用比 3.15 更新的 Apache POI 版本,这仅在 r1762856 中得到修复
您需要 Apache POI 3.16 beta 1 或更新版本,或者现在是 20160930 之后制作的 nightly/svn trunk/git head build
关于java - Apache 兴趣点 3.15 : RegionUtil and BorderStyle?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39765675/
我正在开发一个在网格中加载图像的 C# Winforms 项目,我实现了并行性和线程来了解它,但有些事情我无法弄清楚。我需要在运行时更改一组图片框的 BorderStyle,这是我的代码: Task.
我有一个面板 System.Windows.Forms.Panel 有属性 BorderStyle="FixedSingle" 它呈现灰色边框。 我需要: 能够设置边框的颜色和粗细(如果可能)。 我很
我想在具有最大化窗口状态的父窗体中打开一个子窗体。 我不想让用户最小化/最大化/关闭那个子窗口, 所以我为子窗口设置了 BorderStyle = None 并将 MaximizeBox 和 Mini
有谁知道我怎么写“cardImage1.BorderStyle = BorderStyle.Fixed3D;”无需明确声明“cardImage1”? 我试图将它放入一个方法中,这样我就不需要编写代码来
我想在 Compact Framework 3.5 中为标签和面板制作边框,但没有像 BorderStyle 这样的属性。我搜索和谷歌,但我不知道如何在紧凑的框架中为标签和面板制作边框。 最佳答案 s
我刚刚花了相当多的时间尝试在 GExperts 中使 Delphi 6/7 IDE 的“工具/环境选项”对话框变得相当大。一切似乎都工作正常,直到我发现将表单的 BorderStyle 更改为 bsS
如何在 JavaScript 中将渐变颜色添加到描边样式 Canvas 。请帮助我,我的代码工作完美,但问题只是我一直在尝试向笔划样式添加渐变颜色,但它只是破坏了我的代码。 任何人都可以帮助将这个渐变
当我将 System.Windows.Forms.ListView 放在 WinForm 应用程序(使用 C#/.NET 4.5)的窗体上时,它呈现为平面矩形,即使 BorderStyle 属性设置为
我使用 Apache POI 3.15。我最近切换到最新版本,我们现在有一些已弃用的方法,它们具有“短”边框样式、“短”对齐...对于这些已弃用的方法,我们有带有 Enum 参数的新方法(如 Bord
我换了一个 WinForms TextBox控制没有边界。 当我这样做时,框中文本的底部像素行被切断。 顶部: BorderStyle.Fixed3D (默认)。 底部: BorderStyle.No
这仍然显示纯边框样式。在经历了很多之后,我发现在某些情况下使用 borderRadius 会显示 borderStyle。但仍然 borderStyle 'dotted' 和 'dashed' 对它没
我正在Delphi XE8中开发Firemonkey应用程序,发现以下情况: 我需要以小窗体显示一个小网页,只有一个 TWebBrowser 控件,Align:=Client 且 Form Borde
我想显示/隐藏在 Excel 中使用的“Microsoft Forms 2.0 标签”的边框。 我可以手动将边框样式从 0 - fmBorderStyleNone 更改为 1 - fmBorderSt
我正在尝试删除 UISearchBar 中 UITextField 的 textborderstyle。我知道我正在获取对正确对象的引用,因为我能够将 TextBorderStyle 更改为 Roun
谁能帮帮我?我正在为其使用 React Native Expo SDK 42,它仅在 Android 上显示此错误。我的 iOS 设备上没有错误。我尝试了所有方法,例如添加 Overflow: "hi
我是一名优秀的程序员,十分优秀!