Skip to content

Determine font, font size, bold/italic/underline styles #242

@j-dimension

Description

@j-dimension

Hi,

I am kind of stuck determining the styling of an element. My code looks like this:

            if (childNode.getNodeName().equals("text:p")) {
                    OdfElement odfElement = (OdfElement) childNode;
                    TextPElement pElement = (TextPElement) odfElement;
                    Paragraph newP = targetDoc.addParagraph(pElement.getTextContent());
                
            }

Basically I am browsing a source document and selectively add its content to a target document. I would like to preserve styling - in the example above, I am copying a paragrahs text, and then want to apply the same styling.
However, I have no idea how to determine e.g.

  • font
  • font size
  • bold/italic/underline styles

Could you help pointing in the right direction?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions