Aspose.Words invoked through COM fails to open some Word templates

We are in the process of renewing our license for Aspose.Words for .Net and we have downloaded version 14.8.0 for testing. We have the following issue. We have some Word templates that we can open just fine and others that fail. We are calling Aspose.Words using the COM Helper Class from a Delphi 2007 application. There are approximately 34 templates total and 8 of the templates are failing to open. I am attaching a Word document (Aspose.Words Issue COM HelperClass.docx) containing snippets of calling code with error and debug Call stack. I am also attaching a template that we are able to process with no issues (Address Change.dot) and a template that fails (Dental Insurance.dot). Any assistance in this matter is greatly appreciated.

Hi Richard,

Thanks for the details. We are testing these templates and will get back to you soon.

Best Regards,

I am Richard’s employee and I produced the samples. Is there any progress? We are concerned that we cannot use Aspose.Word to access documents from the current version of Word through the COM helper. This is critical and we are on a deadline.

Our payment for our renewal has been received by Aspose. I need a status update on the progress with this support request. As stated by Tim Simmons, a member of my staff, the inability to access documents from Word 2003 / Word 2007 through the COM helper. This is critical and we have a deadline fast approaching.

We need to get this resolved ASAP.

Thanks,
Richard

Hi Richard,

During my initial investigation, I was able to reproduce the same issue at my end. We need some more time investigate in detail if a workaround is available, otherwise it will be logged into our issue tracking system. We will share more details tomorrow. Sorry for the inconvenience.

Best Regards,

Hi Muhammad,

Can we please get a status update? My boss is asking for an update as the project on which we are engaged is critical.

Best Regards,

Richard

Hi Richard,

This issue has been forwarded to our development team. As this is a Delphi specific issue, we will update you as soon as the issue is analyzed.

Best Regards,

Hi Richard,

Please check your latest thread <a href="</a> for a detailed reply and let us know if further assistance is required. Sorry for the inconvenience.</p><p>Best Regards,</p>

I don’t have access to the thread posted in the Enterprise Support forum so I will post my findings here.

The exception that is being raised is a Floating Point Exception. I am seeing a problem in Delphi 2007, XE5 and XE7. It is possible that your test application in XE7 has floating point exceptions disabled. You can do the same thing in 2007 with the following code. Set8087CW controls the floating point unit of the CPU and is available in the Systems unit.

var
l8087CW: Word;
begin
l8087CW := Default8087CW;
Set8087CW($133f);
try
FComHelper := CoComHelper.Create;
FDocument := FComHelper.Open(aTemplate);
finally
Set8087CW(l8087CW);
end;
// continue working with FDocument

Hi Tim,

You are now part of Enterprise Support account and you can access and follow that thread now.

Regarding floating point exception, thanks for sharing these details. We will test this scenario as well and let you know.

Best Regards,

I also don’t have access to the thread posted in the Enterprise Support Forum. Could you please give me access or post the answer in this Forum?

Thanks, Urs

Hi Urs,

Following are the details for your reference.

We have investigated the issue in detail and following are the observations:

  • If we try to open your attached templates with Borland Delphi, it will not open any of these unless we open these templates in some other programming language and save using Aspose.Words.
  • If we try to open these templates in your mentioned version of Delphi (i.e. 2007), one template will open and the other will not open as mentioned in your referenced post.
  • If we open these templates in the latest version of Delphi (i.e. XE 7), there is no issue at all and both of your templates can be opened and resaved to other formats without any issue.
  • If we open these templates in any other programming language (PHP, ASP or C++ etc.) using COM, there will be no issue at all.

Based on these observations, it can be concluded that this is a Delphi 2007 specific issue which can be resolved using the latest version of Delphi.

Can you please test at your end and let us know if anything is required from Aspose end?

I had registered Aspose.Words.dll with COM using regasm as you can see at http://www.aspose.com/docs/display/wordsnet/Use+Aspose.Words+for+.NET+via+COM+Interop and following was my code.

program AsposeWords;

{$APPTYPE CONSOLE}

uses

ActiveX, ComObj;

var

doc: OleVariant;

helper: OleVariant;

begin

CoInitialize(nil);

helper := CreateOleObject('Aspose.Words.ComHelper');

doc := CreateOleObject('Aspose.Words.Document');

doc := helper.Open('d:/WordSamples/Address+Change.dot');

doc.Save('d:/WordSamples/test1.doc');

CoUninitialize;

writeln('Done');

readln;

end.

Best Regards,