Search in sources :

Example 1 with CTHyperlink

use of org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink in project poi by apache.

the class XSLFTextRun method getHyperlink.

@Override
public XSLFHyperlink getHyperlink() {
    CTTextCharacterProperties rPr = getRPr(false);
    if (rPr == null) {
        return null;
    }
    CTHyperlink hl = rPr.getHlinkClick();
    if (hl == null) {
        return null;
    }
    return new XSLFHyperlink(hl, _p.getParentShape().getSheet());
}
Also used : CTTextCharacterProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties) CTHyperlink(org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink)

Example 2 with CTHyperlink

use of org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink in project tika by apache.

the class XSSFBExcelExtractorDecorator method extractHyperLinksFromShape.

private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException {
    if (ctShape == null)
        return;
    CTShapeNonVisual nvSpPR = ctShape.getNvSpPr();
    if (nvSpPR == null)
        return;
    CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr();
    if (cNvPr == null)
        return;
    CTHyperlink ctHyperlink = cNvPr.getHlinkClick();
    if (ctHyperlink == null)
        return;
    String url = drawingHyperlinks.get(ctHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
    CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover();
    if (ctHoverHyperlink == null)
        return;
    url = drawingHyperlinks.get(ctHoverHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
}
Also used : CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTHyperlink(org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink)

Example 3 with CTHyperlink

use of org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink in project tika by apache.

the class XSSFExcelExtractorDecorator method extractHyperLinksFromShape.

private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException {
    if (ctShape == null)
        return;
    CTShapeNonVisual nvSpPR = ctShape.getNvSpPr();
    if (nvSpPR == null)
        return;
    CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr();
    if (cNvPr == null)
        return;
    CTHyperlink ctHyperlink = cNvPr.getHlinkClick();
    if (ctHyperlink == null)
        return;
    String url = drawingHyperlinks.get(ctHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
    CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover();
    if (ctHoverHyperlink == null)
        return;
    url = drawingHyperlinks.get(ctHoverHyperlink.getId());
    if (url != null) {
        xhtml.startElement("a", "href", url);
        xhtml.characters(url);
        xhtml.endElement("a");
    }
}
Also used : CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTHyperlink(org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink)

Aggregations

CTHyperlink (org.openxmlformats.schemas.drawingml.x2006.main.CTHyperlink)3 CTNonVisualDrawingProps (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps)2 CTShapeNonVisual (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual)2 CTTextCharacterProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties)1