BTW, the mExcelReader is just an instance of a utility class of mine that
encapsulates a few things like the workbook.

/Bengt

2015-09-28 11:02 GMT+02:00 Bengt Rodehav <[email protected]>:

> I got it to work as follows:
>
> *  private boolean isCrossedOut(Sheet theSheet, int theRow, int theCol) {*
>
> *    Row row = theSheet.getRow(theRow - 1);*
> *    Cell cell = row.getCell(theCol - 1);*
> *    XSSFCellStyle style = (XSSFCellStyle) (cell.getCellStyle());*
> *    CTXf cxf = style.getCoreXf();*
> *    long borderIndex = cxf.getBorderId();*
>
> *    CTBorder ctBorder = mStylesTable.getBorderAt((int)
> borderIndex).getCTBorder();*
> *    boolean up = ctBorder.getDiagonalUp();*
> *    boolean down = ctBorder.getDiagonalDown();*
>
> *    if (up && down) {*
> *      return true;*
> *    } else {*
> *      return false;*
> *    }*
> *  }*
>
> The mStylesTable is initialized at program startup as follows:
>
> *  mStylesTable = null;*
> *  for (POIXMLDocumentPart part : ((XSSFWorkbook)
> mExcelReader.getWorkbook()).getRelations()) {*
> *    if (part instanceof StylesTable) {*
> *      mStylesTable = (StylesTable) part;*
> *      break;*
> *    }*
> *  }*
>
> *  if (mStylesTable == null) {*
> *    throw new RuntimeException("Could not find styles table");*
> *  }*
>
> Thanks for your help,
>
> /Bengt
>
>
> 2015-09-28 9:32 GMT+02:00 Bengt Rodehav <[email protected]>:
>
>> Thank you Mark and Dominik. I will try to get this information from the
>> cell style.
>>
>> /Bengt
>>
>> 2015-09-25 18:22 GMT+02:00 Dominik Stadler <[email protected]>:
>>
>>> Hi,
>>>
>>> There was a discussion about how to set diagonal border styling a few
>>> weeks ago, see
>>> http://mail-archives.apache.org/mod_mbox/poi-user/201508.mbox/browser,
>>> it describes how to set a diagonal border, maybe you can use some of
>>> this for reading the information in your case.
>>>
>>> Dominik.
>>>
>>> On Fri, Sep 25, 2015 at 4:21 PM, Mark Beardsley
>>> <[email protected]> wrote:
>>> > The border is part of the style applied to the cell from POIs point of
>>> view.
>>> > What you will need to do is recover the style from the cell - call the
>>> > getCellStyle() method on the object - and then interrogate that to
>>> find out
>>> > what type of border has been applied. If you look at the CellStyle
>>> class,
>>> > you should see that manifest constants have been created that identify
>>> the
>>> > various attributes and they include THICK_BACKWARD_DIAG and
>>> > THIN_FORWARD_DIAG. A simple switch clause should allow you to filter
>>> out the
>>> > cells that are marked with diagonal borders; it is maybe wise to
>>> include
>>> > tests for all of the diagonal options unless you are confident in your
>>> user
>>> > body.
>>> >
>>> >
>>> >
>>> > --
>>> > View this message in context:
>>> http://apache-poi.1045710.n5.nabble.com/Diagonal-border-tp5720338p5720341.html
>>> > Sent from the POI - User mailing list archive at Nabble.com.
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: [email protected]
>>> > For additional commands, e-mail: [email protected]
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>

Reply via email to