RTF to HTML for Libre Spreadsheet - Java

I’m trying to convert RTF to HTML using Libre. Its working fine for Libre Document but giving null value for Spreadsheet.
Below is my java code how I do the parse.

ArrayList<String> styleValue = new ArrayList<String>();
String result;
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable contents = clipboard.getContents(null);
DataFlavor dfRTF = new DataFlavor("text/rtf", "Rich Formatted Text");
DataFlavor dfTxt = DataFlavor.stringFlavor;
result = rtfToHtml(new StringReader(streamToString((InputStream) contents.getTransferData(dfRTF))));

rtfToHtml ()

public static String rtfToHtml(Reader rtf) throws IOException { 
        JEditorPane p = new JEditorPane();
        p.setContentType("text/rtf");
        EditorKit kitRtf = p.getEditorKitForContentType("text/rtf");
        try {
            kitRtf.read(rtf, p.getDocument(), 0);
            kitRtf = null;
            EditorKit kitHtml = p.getEditorKitForContentType("text/html");
            Writer writer = new StringWriter();
            kitHtml.write(writer, p.getDocument(), 0, p.getDocument().getLength());
            return writer.toString();
           
        } catch (BadLocationException e) {
            e.printStackTrace();
        }
        return null;
    }

Appreciated if anyone could help me to fix this for Libre spreadsheet. Please advice.
Thanks

I don’t understand. You have spreadsheets (they’re not “Libre spreadsheets”, at best Open Document Spreadsheets) as RTF files? Are you using the LibreOffice JDK here?