Hi, Yegor
I am writing in reply of our previous discussion about the participiation in GSoC 2012. I have read a lot of documentation for file structures and have become much more familiar with POI code. I have installed Apache POI project on my system from source codes and I have worked with the bugs which you recommended me. bug 52272. I reproduced this problem and understood it's reason. When the sheet is cloned all of their drawing records assembles into EscherAggregate record and when you call clonedSheet.getDrawingPatriarch() it checks if this sheet contains any drawing records. If they are already assembled into EscherAggregate record it returns null. So, to fix this bug enough to remove checking of drawing records in HSSFSheet.getDrawingEscherAggregate(). The patch what already fixes this bug was already attached to https://issues.apache.org/bugzilla/show_bug.cgi?id=52272 when I visited this page and I don't know why it wasn't applied.

bug 51676. I couldn't reproduce this problem, however I wrote the code what was pretty same to those what was attached to page with this bug.
Here it is:


FileOutputStream fileOut = new FileOutputStream("d:\\Projects\\google\\resource\\111.xls");
        Workbook wb = new HSSFWorkbook();
        Sheet s = wb.createSheet("new sheet");
        Row row = s.createRow(5);
        row.createCell(5);
        Cell cell = wb.getSheetAt(0).getRow(5).getCell(5);
        CreationHelper createHelper =
                cell.getSheet().getWorkbook().getCreationHelper();
        Sheet sheet = cell.getSheet();
        Drawing drawingPatriarch = drawingPatriarches.get(sheet);
        if (drawingPatriarch == null) {
            drawingPatriarch = sheet.createDrawingPatriarch();
            drawingPatriarches.put(sheet, drawingPatriarch);
        }

        ClientAnchor anchor = createHelper.createClientAnchor();
        anchor.setCol1((short)4);
        anchor.setRow1(2);
        anchor.setCol2((short)10);
        anchor.setRow2(8);
        Comment comment = drawingPatriarch.createCellComment(anchor);
        comment.setString(createHelper.createRichTextString("111"));
        cell.setCellComment(comment);
        wb.write(fileOut);
        fileOut.close();

I checked target file in Microsoft Excel 2010 and Mocrosoft Excel XP and I didn't catch any errors or warnings.

I have thought about the idea you proposed:
>Improve support for drawings in HSSF. The main problem is that you
>can create new drawings from scratch but cannot modify existing ones.
>This task will require deep understanding of the Excel Biff8 and MS
>Binary Drawing(Escher) formats and current architecture of the HSSF
>module.

As I understand to fix this problem I have to add to each class what extends HSSFShape some methods to modify exisiting object and add some api to HSSFPatriarch for searching for shapes by some criterias. Am I right?

Thanks you much.
With best regards, Evgeniy Berlog.

I am sorry about my poor English((

Reply via email to