The sample document (email) has an URI “/”. An exception occurs:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
at java.base/java.lang.String.charAt(String.java:693)
at com.aspose.words.internal.zzYfn.zzQR(Unknown Source)
at com.aspose.words.internal.zzYfn.zzYLk(Unknown Source)
at com.aspose.words.internal.zzYfn.zzX1N(Unknown Source)
...
at com.aspose.words.Document.save(Unknown Source)
Converter Fehler Veraktung Rendition Server.zip (54.3 KB)
Code:
public static void main( String[] args ) throws Exception {
String source = "C:\\Ceyoniq\\Beispiele\\Fehler Veraktung Rendition Server.msg";
try ( InputStream fis = new FileInputStream( source ) ) {
MailMessage eml = MailMessage.load( fis );
// save to MHTML without attachments
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MhtSaveOptions so = SaveOptions.getDefaultMhtml();
so.setSaveAttachments( false );
eml.save( baos, so );
// load MHTML to word
LoadOptions lo = new LoadOptions();
lo.setLoadFormat(LoadFormat.MHTML);
Document doc = new Document( new ByteArrayInputStream( baos.toByteArray() ), lo );
doc.save("C:\\Ceyoniq\\Beispiele\\Fehler Veraktung Rendition Server.pdf", SaveFormat.PDF);
}
}