HTML Rich text to Office compatible String

Im trying to convert HTMl Rich Text to a String that is compatible with Office, im exporting in an excel, but i want to set this text into a cell, so exporting as a doc is not exactly what i need.

These are the examples a looked, i need the String, so im trying to get the data as String. But export as RTF is not supported.

InputStream targetStream = new FileInputStream(new File("C:\\AsposeTest\\" + "in.html"));
        Document doc = new Document(targetStream);

        RtfSaveOptions rtfSaveOptions = new RtfSaveOptions();
        rtfSaveOptions.setExportCompactSize(true);
        rtfSaveOptions.setExportImagesForOldReaders(false);
        rtfSaveOptions.setSaveFormat(SaveFormat.RTF);
        doc.save("C:\\AsposeTest\\" + "rtf.rtf", rtfSaveOptions);
        String temp = doc.getParentNode().toString(SaveFormat.RTF);
        if (temp != null) {
            System.out.println("RTF content generated successfully.");
        } else {
            System.out.println("Failed to generate RTF content.");
        }

Error im getting:

Exception in thread "main" java.lang.IllegalStateException: Exporting fragments of a document in this format is not supported.
	at com.aspose.words.zzCP.zzZ(Unknown Source)
	at com.aspose.words.Node.toString(Unknown Source)

in.7z (473 Bytes)

@Lcv9988 You can use the following code to convert input document to RTF string:

Document doc = new Document("C:\\Temp\\in.txt");
ByteArrayOutputStream rtfStream = new ByteArrayOutputStream();
doc.save(rtfStream, SaveFormat.RTF);
String rtfString = new String(rtfStream.toByteArray(), StandardCharsets.UTF_8);