Thread

Posted on Wed May 21 14:56:03 2008 by glider
probably a bug : replaceElement looses original font
i have 2 documents A and B. In document A i define some styles ( paragraph + character ). I then use replaceElement to copy all the named styles
if($doc){ #now copy the named style root of the source file my $named_style_root_to_replace = $my_target_styles->getNamedStyleRoot(); if($named_style_root_to_replace){ $my_target_styles->replaceElement($named_style_root_to_replace, $named_style_root); } }
the style is copied, however the font of the copied style differs from the original.
Direct Responses: 8026 | Write a response
Posted on Thu Jun 5 17:03:42 2008 by jmgdoc in response to 7916
Re: probably a bug : replaceElement looses original font

When a font name is set (generally through a 'style:font-name' text property) in a new style, take care of the availability of the corresponding font declaration in the document. A font is not rendered if it's not declared (see importFontDeclaration()).

Importing a style doesn't automatically imports the related fonts. If the imported style has a 'style:font-name' property, or inherits such a property from its parent style, the corresponding font must be explicitly imported in the target document.

More details about related methods, i.e. getFontDeclaration() and importFontDeclaration(), in the OpenOffice::OODoc::Styles manual.
Write a response