2

I am currently migrating an application from jdk 8 to 11 but I have some issue with Apache Poi library. Some classes, methods and constants were removed and I am unable to find a migration guide from their website. The previous version was 3.13 and I upgraded it to 4.0.1.

This is an example of errors:

enter image description here

Any help will be appreciated.

Thanks

akuma8
  • 4,160
  • 5
  • 46
  • 82
  • 1
    What exactly has been removed according to you? Your screenshot (which you should have included as code itself) doesn't say anything (or does the color `red` indicate errors here?) – XtremeBaumer Feb 22 '19 at 11:43
  • @XtremeBaumer Sorry I thought that everyone uses IntelliJ! Yes the red color indicates errors – akuma8 Feb 22 '19 at 11:53

1 Answers1

2

This is a list of the updated methods/parameters you need with apache poi 4

stepFont.setBold(true);
pathIdCellStyle.setAlignment(HorizontalAlignment.CENTER);
pathIdCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
pathIdCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
pathIdCellStyle.setFillPattern(FillPatternType.THIN_FORWARD_DIAG);

I am not aware of a migration guide, so the most convenient way I found (using Eclipse IDE) is to type the variable name (e.g. pathIdCellStyle), add the dot for a method call and then let auto-complete do its job. It suggest you all available methods as well as the parameters you need to pass in (with the actual class you need to use)

XtremeBaumer
  • 6,275
  • 3
  • 19
  • 65
  • Is there somewhere where I can find these methods (say a list of old methods and their replacement)? Autocompletion works the same in IntelliJ but if a method is absent the IDE can't propose it. This is the case for the `setBoldWeight(..)` for example. – akuma8 Feb 22 '19 at 12:16
  • AFAIK there is no list. Thats why I suggest the autocompletion feature. Lets say you type `stepFont.set`, then it suggest all the `set` methods. Part of this methods is `setBold(boolean value)`. Some logical thinking and you know that `setBoldWeight(...)` has been replaced by `setBold(boolean)`. If you are still unsure, or the result is not the desired one, simply search for that specific replacement on google – XtremeBaumer Feb 22 '19 at 12:25
  • The problem is the jump between so many versions. From one version to the next, things will be `@deprecated` with a javadoc comment on the change, but there's nothing covering the jump of 5+ versions like the OP is doing – Gagravarr Feb 22 '19 at 13:19
  • And I have another problem that is I've never used this library before... That's why I am a bit confused ^^! – akuma8 Feb 22 '19 at 13:21