How to convert Word document to HTML?

Figured I’d would check in for my monthly status update :slight_smile:

Any news on this item or any workarounds that I can try to see if it will work via ColdFusion?

Thanks,

I turned on robust debugging in ColdFusion and got a little bit more information that perhaps may help:

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at coldfusion.runtime.java.JavaProxy.CreateObject(JavaProxy.java:156)
	at coldfusion.runtime.java.JavaProxy.invoke(JavaProxy.java:63)
	at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2272)
	at cfASPoseTest2ecfm1979376716.runPage(C:\Inetpub\wwwroot\CFTest\ASPoseTest.cfm:99)
	at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
	at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
	at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
	at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
	at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
	at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
	at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
	at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
	at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
	at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
	at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
	at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
	at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
	at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
	at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:126)
	at coldfusion.CfmServlet.service(CfmServlet.java:175)
	at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
	at jrun.servlet.FilterChain.service(FilterChain.java:101)
	at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
	at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
	at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
	at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
	at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
	at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
	at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Caused by: com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
	at com.aspose.words.Document.a(Document.java:1371)
	at com.aspose.words.Document.b(Document.java:1358)
	at com.aspose.words.Document.a(Document.java:1246)
	at com.aspose.words.Document.(Document.java:143)
	at com.aspose.words.Document.(Document.java:117)
	… 38 more
Caused by: java.lang.IllegalStateException: java.nio.charset.UnsupportedCharsetException: UTF-7
	at asposewobfuscated.kj.OK(Encoding.java:475)
	at asposewobfuscated.kj.OG(Encoding.java:237)
	at asposewobfuscated.kj.af(Encoding.java:453)
	at com.aspose.words.iv.nW(FileFormatDetector.java:246)
	at com.aspose.words.iv.g(FileFormatDetector.java:38)
	at com.aspose.words.Document.b(Document.java:1262)
	… 41 more
Caused by: java.nio.charset.UnsupportedCharsetException: UTF-7
	at java.nio.charset.Charset.forName(Charset.java:506)
	at asposewobfuscated.kj.OK(Encoding.java:471)
	… 46 more

Hi

Thanks for your request. Unfortunately, there are no news regarding this issue.

In your stack trace, I can see “FileCorruptedException”. This exception is thrown when the file is corrupted and Aspose.Words cannot open it. Could you please attach the document, which causes this exception on your side?

Best regards.

I did some more testing and compiled it from a .java file.
I made as basic a file as I could for the htm file

Testing

I then read this file in (I placed the code in the “main” method of my java class), and save it as .rtf. Doing so via Java works correctly (running it via the console in Eclipse). I then put this code into a “save” method within my java class and tried calling that from ColdFusion and I get

“The document appears to be corrupted and cannot be loaded”

Here’s the java class I was using

package com.myCompany;

//ExStart
//ExId:LoadTxt
//ExSummary:Loads a plain text file into an Aspose.Words.Document object.

import com.aspose.words.*;

public class GarethDocument
{
    public static void main(String[] args) throws Exception
    {
    }

    public void save() throws Exception {
        Document document = new Document(“c:/Temp/GarethOutputTest.htm”);
        document.save(“c:/Temp/FromJavaLoadTxtOut.rtf”);
    }
}

Then in my coldFusion test page:

<cfset garethDoc.save() />

Nothing crazy in there. It’s hard coded to load the file, but just seems to screw something up when it tries.

Hi

Thank you for additional information. Have you tried specifying load format explicitly in your java class?

Also, you can try using InsertHtml method for testing. You can read your HTML document to String and then insert this string into an empty document using InsertHtml, maybe this will work for you as a workaround:

Best regards.

Woohoo! Success :slight_smile:

Very slightly convoluted (used your insertHtml method), but that got it into the doc and converted to rtf when saving.

Excellent!

If you manage to get the HTML side working (without using insertHtml), please let me know, but hopefully this will be a nice workaround for now.

Thanks for all of your assistance with this.

Hi

It is perfect that this approach works for you. Sure, we will let you know once the original issue is resolved.

Best regards.

The issues you have found earlier (filed as 11499) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan