[prev in list] [next in list] [prev in thread] [next in thread] 

List:       poi-dev
Subject:    Re: bug or i am userd not correctly?
From:       Dominik Stadler <dominik.stadler () gmx ! at>
Date:       2020-04-24 21:01:30
Message-ID: CABdJj579q4mK=+i99WiBH53uES-3jvFWCTjmOcmyC8jQcRU5sg () mail ! gmail ! com
[Download RAW message or body]


Hi,

This should be now fixed again via
https://svn.apache.org/viewvc?view=rev&rev=1876949, you can try with one of
the next nightly builds on
https://builds.apache.org/view/P/view/POI/job/POI-DSL-1.8/

This will be included in the next release of Apache POI, either 4.1.3 or
4.2.

Thanks... Dominik.


On Fri, Apr 24, 2020 at 11:38 AM Dominik Stadler <dominik.stadler@gmx.at>
wrote:

> Hi,
>
> yes, that seems to be a change introduced via
> https://svn.apache.org/viewvc?view=revision&revision=1849969 in
> https://bz.apache.org/bugzilla/show_bug.cgi?id=60845
>
> I will take a closer look why the changed equals has such a side-effect.
>
> Thanks... Dominik.
>
> On Tue, Apr 21, 2020 at 5:47 AM shuai yuan <yangyuanshuai053@gmail.com>
> wrote:
>
>> dear:
>> apache poi setDiagonal is effective in poi 4.0.1 but not effective in
>> 4.1.0. i really want to know why.
>>
>> package org.quartz.core;
>> import java.io.FileOutputStream;
>>
>> import org.apache.poi.ss.usermodel.BorderStyle;
>> import org.apache.poi.ss.usermodel.Cell;
>> import org.apache.poi.ss.usermodel.CellStyle;
>> import org.apache.poi.ss.usermodel.Sheet;
>> import org.apache.poi.xssf.model.StylesTable;
>> import org.apache.poi.xssf.model.ThemesTable;
>> import org.apache.poi.xssf.streaming.SXSSFWorkbook;
>> import org.apache.poi.xssf.usermodel.XSSFCellStyle;
>> import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
>> import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorder;
>> import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr;
>> import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf;
>> import org.openxmlformats.schemas.spreadsheetml.x2006.main.STBorderStyle;
>> class CellDiagonalBorders {
>> private static CTBorder getCTBorder(StylesTable _stylesSource, CTXf
>> _cellXf) {
>> CTBorder ct;
>> if (_cellXf.getApplyBorder()) {
>> int idx = (int) _cellXf.getBorderId();
>> XSSFCellBorder cf = _stylesSource.getBorderAt(idx);
>> ct = (CTBorder) cf.getCTBorder().copy();
>> } else {
>> ct = CTBorder.Factory.newInstance();
>> }
>> return ct;
>> }
>> public static void setBorderDiagonal(BorderStyle border, StylesTable
>> _stylesSource, CTXf _cellXf,
>> ThemesTable _theme) {
>> CTBorder ct = getCTBorder(_stylesSource, _cellXf);
>> CTBorderPr pr = ct.isSetDiagonal() ? ct.getDiagonal() :
>> ct.addNewDiagonal();
>> if (border == BorderStyle.NONE) {
>> ct.unsetDiagonal();
>> } else {
>> ct.setDiagonalUp(true);
>> pr.setStyle(STBorderStyle.Enum.forInt(border.getCode()+1));
>> }
>> int idx = _stylesSource.putBorder(new XSSFCellBorder(ct, _theme,
>> _stylesSource.getIndexedColors()));
>> System.out.println(idx);
>> _cellXf.setBorderId(idx);
>> _cellXf.setApplyBorder(true);
>> }
>> public static void main(String[] args) throws Exception {
>> SXSSFWorkbook wb = new SXSSFWorkbook(SXSSFWorkbook.DEFAULT_WINDOW_SIZE);
>> CellStyle style = wb.createCellStyle();
>> style.setBorderTop(BorderStyle.THICK);
>> style.setBorderBottom(BorderStyle.THICK);
>> StylesTable _stylesSource = ((SXSSFWorkbook)
>> wb).getXSSFWorkbook().getStylesSource();
>> if (_stylesSource != null) {
>> ThemesTable _theme = _stylesSource.getTheme();
>> CTXf _cellXf = ((XSSFCellStyle) style).getCoreXf();
>> setBorderDiagonal(BorderStyle.THICK, _stylesSource, _cellXf, _theme);
>> }
>> style.setBorderLeft(BorderStyle.THICK);
>> style.setBorderRight(BorderStyle.THICK);
>> Sheet sheet = wb.createSheet("Sheet1");
>> Cell cell = sheet.createRow(1).createCell(2);
>> cell.setCellStyle(style);
>> FileOutputStream fileOut = new
>> FileOutputStream("CellDiagonalBorders.xlsx");
>> wb.write(fileOut);
>> wb.close();
>> if (wb instanceof SXSSFWorkbook)
>> ((SXSSFWorkbook) wb).dispose();
>> }
>> }
>>
>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic