× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Just to get a better idea of how Java works, you might look at Scott's presentation at -

https://www.scottklement.com/presentations/Excel%20Spreadsheets%20from%20RPG%20with%20POI.pdf

The first few slides give a nice explanation of Java, components.

The example you show is a method (what we call functions in RPG) for adding a comment - it has several Java method calls along the way. In Scott's service program are similar things - the functions there make Java method calls to do their work.

Someone else will have to add more here - I don't have the source for Scott's service program in front of me, you should have it if you've installed it. I'm not even sure which version of POI added support for comments.

Regards
Vern

On 4/3/2021 2:57 AM, gio.cot via RPG400-L wrote:
Hi Vern

Thanks for your reply .. i have try to look for some example but i found
only java example and i'm not expert in java .. i tryed to understand this
java example and how to convert in RPGLE but i don't understand to menage
"factory" object

This is the link that i have found
https://stackoverflow.com/questions/7153254/how-to-add-cell-comments-to-exce
l-sheet-using-poi

public void addComment(Workbook workbook, Sheet sheet, int rowIdx, int
colIdx, String author, String commentText) {

CreationHelper factory = workbook.getCreationHelper();

//get an existing cell or create it otherwise:

Cell cell = getOrCreateCell(sheet, rowIdx, colIdx);


ClientAnchor anchor = factory.createClientAnchor();

//i found it useful to show the comment box at the bottom right
corner

anchor.setCol1(cell.getColumnIndex() + 1); //the box of the comment
starts at this given column...

anchor.setCol2(cell.getColumnIndex() + 3); //...and ends at that
given column

anchor.setRow1(rowIdx + 1); //one row below the cell...

anchor.setRow2(rowIdx + 5); //...and 4 rows high


Drawing drawing = sheet.createDrawingPatriarch();

Comment comment = drawing.createCellComment(anchor);

//set the comment text and author

comment.setString(factory.createRichTextString(commentText));

comment.setAuthor(author);


cell.setCellComment(comment);

}


Can some help me ?

Thanks in advance



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.