diff options
Diffstat (limited to 'poi-ooxml/src/main/java')
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index ed45e1208d..b30883966a 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -104,6 +104,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx private final XSSFDataValidationHelper dataValidationHelper; private XSSFVMLDrawing xssfvmlDrawing; private CellRangeAddress dimensionOverride; + private double arbitraryExtraWidth = 0.0; /** * Creates new XSSFSheet - called by XSSFWorkbook to create a sheet from scratch. @@ -498,6 +499,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx if (width != -1) { width *= 256; + width += arbitraryExtraWidth; int maxColumnWidth = 255*256; // The maximum column width for an individual cell is 255 characters if (width > maxColumnWidth) { width = maxColumnWidth; @@ -508,6 +510,30 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx } /** + * Set the extra width added to the best-fit column width (default 0.0). + * <p> + * Only applied to auto-sized columns. + * </p> + * @param arbitraryExtraWidth the extra width added to the best-fit column width + * @since 5.4.1 + */ + public void setArbitraryExtraWidth(final double arbitraryExtraWidth) { + this.arbitraryExtraWidth = arbitraryExtraWidth; + } + + /** + * Get the extra width added to the best-fit column width. + * <p> + * Only applied to auto-sized columns. + * </p> + * @return the extra width added to the best-fit column width + * @since 5.4.0 + */ + public double getArbitraryExtraWidth() { + return arbitraryExtraWidth; + } + + /** * Return the sheet's existing drawing, or null if there isn't yet one. * * Use {@link #createDrawingPatriarch()} to get or create |