Summary: | Add to public API POIXMLDocumentPart.removeRelation(POIXMLDocumentPart part) | ||
---|---|---|---|
Product: | POI | Reporter: | Aurélien <amanteaux+bzapache> |
Component: | XSLF | Assignee: | POI Developers List <dev> |
Status: | NEW --- | ||
Severity: | enhancement | ||
Priority: | P2 | ||
Version: | 3.16-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All |
Description
Aurélien
2016-12-21 15:24:25 UTC
While we could make it public, that would also open the door to lots of ways to completely break a workbook. I'd prefer to see a higher level API for replacing one image with another that would handle these details internally in a consistent manner, with lots of unit tests. Patches are always welcome, as waiting for a volunteer to have the time and inclination to add a specific feature can take some time :) Short of a patch, a robust discussion of what exactly an API improvement might look like, including test vectors, is still helpful. For example, it may be that different document types need to handle image replacement differently. I haven't dug in to how the different formats do it, but cell vs. slide vs. paragraph anchor references seem like one area that may be different. Ideally there should be some consistency between document types for image replacement, and perhaps some checks as well if there are constraints or decisions needed when images differ in size, for example. (In reply to Aurélien from comment #0) > Currently the method POIXMLDocumentPart.removeRelation(POIXMLDocumentPart > part) is protected. > Would it be possible to change the visibility of this method to public? > Thank you for your detailed reply. About the containers in which an image can be, I counted only 2 containers: - a XSLFSlide, - a XSLFGroupShape. There doesn't seem to be any way to put an image in a paragraph or in a table. About the test vector, what do you have in mind? I am actually working on the library https://github.com/Coreoz/PPT-Templates that is highly based on POI XSLF, but it difficult to write tests since it is often in PowerPoint that I can verify whether the image replacement is working, or if the PPT slide is corrupted. (In reply to Aurélien from comment #2) > About the containers in which an image can be, I counted only 2 containers: > - a XSLFSlide, > - a XSLFGroupShape. > There doesn't seem to be any way to put an image in a paragraph or in a > table. I was thinking about Word and Excel files as well, not just PowerPoint. Some of the graphics objects are common but handled independently, and perhaps that could/should be standardized in some respects. > > About the test vector, what do you have in mind? > I am actually working on the library https://github.com/Coreoz/PPT-Templates > that is highly based on POI XSLF, but it difficult to write tests since it > is often in PowerPoint that I can verify whether the image replacement is > working, or if the PPT slide is corrupted. Anything you can see as right/wrong in PowerPoint visually should be represented in the XML somehow, so it should be testable. The key is ensuring the "expected" values are correct manually, possibly by viewing an "expected result" master file in PowerPoint, then building a test case around it. |