poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javen O'Neal" <javenon...@gmail.com>
Subject Re: SpreadsheetVersion
Date Thu, 31 Dec 2015 07:56:53 GMT
I'd put it in the Workbook interface. Then again, I'm not a huge fan of
Utils, since they don't work well for overriding or compartmentalizing
features.
On 30 Dec 2015 19:40, "Mark Murphy" <jmarkmurphy@gmail.com> wrote:

> I am working through drawing borders in POI without creating needless
> CellStyles. Still having trouble with BORDER_NONE, I am thinking that I
> need to make the adjacent borders BORDER_NONE as well, and went looking for
> a method to retrieve the SpreadsheetVersion. Only found some code for a
> ternary that produces it based on the workbook's class. I still would like
> to have a simple helper method like getSpreadsheetVersion() either in
> WorkbookUtil, or in Workbook (and therefore XSSFWorkbook and HSSFWorkbook).
> If in WorkbookUtil, it would return the results of the ternary:
>
> public static SpreadsheetVersion getSpreadsheetVersion (Workbook workbook)
> {
>     return (workbook instanceof HSSFWorkbook) ? SpreadsheetVersion.EXCEL97
> :
>            SpreadsheetVersion.EXCEL2007;
> }
>
> In XSSFWorkbook (and HSSFWorkbook) it would simply return the appropriate
> spreadsheet version.
>
> public SpreadsheetVersion getSpreadsheetVersion() {
>     return SpreadsheetVersion.EXCEL2007;  // EXCEL97 for HSSFWorkbook
> }
>
> I would prefer to say ssV = workbook.getSpreadsheetVersion() verses the
> above ternary where I need the spreadsheet version. The user shouldn't need
> to know how it is derived, and if Microsoft changes the limits in the
> future, we will be able to easily set it and allow userland code to remain
> unchanged. Otherwise users of POI must know how the spreadsheet version is
> derived.
>
> For the moment I am going to put the code into WorkbookUtil since the Util
> classes seem to be a more acceptable location for new contributors to put
> stuff.
>
> I would rather it go in the Workbook class though.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message