Hey there,
i am currently migrating a project, that is using a very old version of the
odftoolkit.
There are methods that should place an image inside an odt file. Some of
the classes and methods are no longer available in the new odftoolkit
0.10.0. Do you have any suggestion how i can solve that?
Thank you so much.
Maike
/**
* Austauschen (Art 1) des Platzhalters gegen eine Bilddatei.
*
* @param odt Template im Format ODT.
* @param picPlaceHolder Platzhalter-Name für das einzufügende Bild.
z.B. "Bild1"
* @param uriImgageFile URI zur Bilddatei, die eingefügt werden soll.
*/
public static void imageFileIntegration(TextDocument odt, String
picPlaceHolder, URI uriImgageFile, double picHeight, double picWidth) {
final TextNavigation textNav = new TextNavigation(picPlaceHolder,
odt);
while (textNav.hasNext()) {
final TextSelection item1 = (TextSelection)
textNav.nextSelection();
try {
org.odftoolkit.simple.draw.Image imgReplace =
item1.replaceWith(uriImgageFile);
FrameRectangle rect1 = imgReplace.getRectangle();
rect1.setLinearMeasure(
StyleTypeDefinitions.SupportedLinearMeasure.PT
<http://styletypedefinitions.supportedlinearmeasure.pt/>);
rect1.setHeight(picHeight);
rect1.setWidth(picWidth);
imgReplace.setRectangle(rect1);
} catch (InvalidNavigationException e) {
e.printStackTrace();
}
}
}
/**
* Austauschen (Art 1) des Platzhalters gegen eine Bilddatei.
*
* @param textSelection Textausschnitt aus dem ODT-Dokument, der
durch das Bild ersetzt werden soll
* @param uriImgageFile URI zur Bilddatei, die eingefügt werden soll.
* @param picWidth Breite
* @param picHeight Höhe
*/
public static void imageFileReplaceTextSelection(TextSelection
textSelection, URI uriImgageFile, double picHeight, double picWidth ) {
try {
org.odftoolkit.simple.draw.Image imgReplace =
textSelection.replaceWith(uriImgageFile);
FrameRectangle rect1 = imgReplace.getRectangle();
rect1.setLinearMeasure(
StyleTypeDefinitions.SupportedLinearMeasure.PT
<http://styletypedefinitions.supportedlinearmeasure.pt/>); // Angabe soll
in Punkten erfolgen
rect1.setHeight(picHeight);
rect1.setWidth(picWidth);
imgReplace.setRectangle(rect1);
} catch (InvalidNavigationException e) {
e.printStackTrace();
}
}
--
To unsubscribe e-mail to: dev+unsubscribe@odftoolkit.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.odftoolkit.org/dev/
Privacy Policy: https://www.documentfoundation.org/privacy
Context
- [dev] migrate from odftoolkit 0.8.0 to 0.10.0 · Maike Keune-Staab
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.