Continue with my actual bug: Remove XWPFHyperlinkRun Apache POI
With this code:
public void eliminarHyperLink(XWPFDocument doc){
XWPFHeaderFooterPolicy policy= doc.getHeaderFooterPolicy();
XWPFFooter footer = policy.getDefaultFooter();
List<XWPFParagraph> paragraphs = footer.getParagraphs();
boolean primero = false;
for (XWPFParagraph xwpfParagraph : paragraphs) {
List<XWPFRun> runs = xwpfParagraph.getRuns();
if(primero == true){
for (XWPFRun run : runs) {
if(run instanceof XWPFHyperlinkRun) {
XWPFHyperlinkRun linkRun = (XWPFHyperlinkRun)run;
((XWPFHyperlinkRun) run).getCTHyperlink();
System.out.println(((XWPFHyperlinkRun) run).getCTHyperlink()); //Here is the output xml showen below
}
}
}
primero = true;
}
}
Reaches the xml that contains an hyperlink than I need to remove, is there a way to remove that?
<xml-fragment r:id="rId1" w:history="1" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
<w:r w:rsidRPr="003A2DF6">
<w:rPr>
<w:rFonts w:ascii="Adobe Caslon Pro" w:hAnsi="Adobe Caslon Pro"/>
<w:b/>
<w:sz w:val="16"/>
<w:szCs w:val="16"/>
</w:rPr>
<w:t>www.cnbv.gob.mx</w:t> //This is what I need to remove!!!!!!!!!!!
</w:r>
</xml-fragment>
Please if someone had any answers I will be really gratefull! Regards.