Reputation: 86381
I'm trying to convert a Eclipse Draw2D Figure to a PowerPoint page by implementing org.eclipse.draw2d.Graphics
with Apache POI's XSLF API.
Apache POI's HSLF API supports a similar approach for AWT drawing, implementing java.awt.Graphics2D
with HSLF class org.apache.poi.hslf.model.PPGraphics2D
.
The base graphics classes for both AWT and Draw2D provide methods to clip subsequent drawing. This is highly useful when drawing part of a larger scene.
The Apache POI implementation of the AWT graphics methods to set the clipping region is to log a warning. This suggests that it might not be feasible to clip arbitrary drawing in a PowerPoint page. So too does the apparent lack of controls for setting such clipping within the PowerPoint application itself.
Questions:
A) Is clipping feasible in PowerPoint documents?
B) If so, how can clipping be requested through Apache POI?'
C) If not, what are possible workarounds?
Notes:
In my case, I have adjacent columns that each need to be clipped. Laying big background-colored rectangles over the margins isn't sufficient.
Upvotes: 1
Views: 307
Reputation: 3446
Please have a look at org.apache.poi.sl.draw.SLGraphics
- I might remove the PPGraphics2D class in the not so far future.
A) I think it's not such an big issue, I've did some rudimentary clipping in Graphics2d context for JasperReports
B) maybe via opening a feature request ;)
C) The workaround is to extend SLGraphics (preferably) or PPGraphics2D, but you basically would need to include the clipping in all drawing calls, i.e. clip all shapes.
Upvotes: 3