java-mammoth icon indicating copy to clipboard operation
java-mammoth copied to clipboard

Cross-references are not converted in anchors

Open DunaMariusCosmin opened this issue 4 years ago • 0 comments

Hi, Some cross-references are not converted in anchors. I attached a sample: sample.docx

The result of the conversion should be:

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title/>
    </head>
    <body>
        <h1>Title</h1>
        <p>Reference to: <a href="#_Ref66182243">Heading</a></p>
        <h1><a id="_Ref66182243"/>Heading</h1>
        <p>Content1</p>
    </body>
</html>

but the "a" element with the "href" attribute is not added.

This kind of references have the "REF" field definition with the "\h" argument: https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_REFREF_topic_ID0ESRL1.html

This can be a possible fix: https://github.com/DunaMariusCosmin/java-mammoth/commit/0e23540daedbb0d7c4295b575f891a30e4142f4b

Best regards, Cosmin

DunaMariusCosmin avatar Mar 09 '21 15:03 DunaMariusCosmin