In the following, all the setAttributeNS calls are broken because that
method no longer exists, and the class OdfFontFace no longer exists.
stylesDom = outputDocument.getStylesDom();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(stylesDom);
OdfTextProperties defaultTp =
(OdfTextProperties)
xpath.
evaluate("/office:document-styles/office:styles/style:default-style/style:text-properties",
stylesDom,
XPathConstants.NODE);
if (language == LanguageCode.ARABIC || language ==
LanguageCode.PERSIAN || language == LanguageCode.PUSHTO) {
defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
"language-complex", language.ISO639_1());
defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
"font-name-complex", ARABIC_FONT_NAME);
OdfFontFaceDecls fontFaceDecls = (OdfFontFaceDecls)
xpath.evaluate("/office:document-content/office:font-face-decls",
contentDom,
XPathConstants.NODE);
OdfFontFace face = new OdfFontFace(contentDom);
face.setName(ARABIC_FONT_NAME);
face.setFontFamily(ARABIC_FONT_NAME);
face.setFontPitch(OdfFontPitchType.VARIABLE);
face.setFontSize("20");
fontFaceDecls.appendChild(face);
}
On Wed, Oct 16, 2013 at 8:21 AM, Benson Margulies <[email protected]>wrote:
> most of the classes in there are not just deprecated but deleted.
> details to follow.
>
> > On Oct 16, 2013, at 4:36 AM, Svante Schubert <[email protected]>
> wrote:
> >
> > Uncertain what's the problem. Is it some deprecation?
> > In this case it is due to the Simple API, introduced by the IBM team.
> > I still work with the deprecated parts as I am free to change/refactor
> > more radical.
> > Name the problem and I will try to help.
> >
> > Best regards,
> > Svante
> >
> > Am 15.10.2013 21:22, schrieb Benson Margulies:
> >> Can someone help me out with the modern equivalent of the following?
> >>
> >>
> >> OdfTextProperties defaultTp =
> >> (OdfTextProperties)
> >> xpath.
> >>
> >>
> evaluate("/office:document-styles/office:styles/style:default-style/style:text-properties",
> >> stylesDom,
> >> XPathConstants.NODE);
> >> if (language == LanguageCode.ARABIC || language ==
> >> LanguageCode.PERSIAN || language == LanguageCode.PUSHTO) {
> >> defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
> >> "language-complex", language.ISO639_1());
> >> defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
> >> "font-name-complex", ARABIC_FONT_NAME);
> >> OdfFontFaceDecls fontFaceDecls = (OdfFontFaceDecls)
> >>
> >> xpath.evaluate("/office:document-content/office:font-face-decls",
> >> contentDom,
> >> XPathConstants.NODE);
> >> OdfFontFace face = new OdfFontFace(contentDom);
> >> face.setName(ARABIC_FONT_NAME);
> >> face.setFontFamily(ARABIC_FONT_NAME);
> >> face.setFontPitch(OdfFontPitchType.VARIABLE);
> >> face.setFontSize("20");
> >> fontFaceDecls.appendChild(face);
> >> }
> >
>