And here is the error message I get:
In Project S:.… occured an error with the following message: ‘Floating Point invalid Operation at 0x79aa47a8’. Process stopped…
Does anyone has the same issue or a solution for this Problem?
Sorry, I was not able to see the issue at my end using the samples I have. Can you please share your sample document to reproduce the issue? This looks like a document specific issue.
Thanks for the details. I was able to see the same issue at my end. We are further investigating this issue and will let you know once we have any update. Sorry for the inconvenience.
Yes, Aspose.Words supports PDF/A and it can also be used within a service however further investigation is required for your original issue i.e Document.Save method is throwing exception on saving your documents.
Can you please also contact Delphi team in the meantime as in Delphi some documents do not work however same documents work in other programming languages when used via COM?
hi,
Seems to have the same problem with a com dll (framework 4.8.1 / aspose.word 23.1) called in a Delphi 10.4 project.
The call of a function raise the exception ‘floating invalid operation’
Please, a idea ?
using Aspose.Words.Replacing;
using Aspose.Words;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
// signed mdp : diamiccs
// https://blogs.embarcadero.com/using-a-net-assembly-via-com-in-delphi/#Introduction
namespace PilotTest
{
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[Guid("5BD21BCE-7CF3-454B-A3E0-D5348F8C6A9B")]
public interface IPilotTest
{
[DispId(1)]
string wdFileOpen(string pPath);
[DispId(2)]
string WdFileNew(string pNomModele, int pNuModele);
[DispId(3)]
string WdFileSaveAs(string pPath);
[DispId(4)]
string WdFileSaveAsFormat(string pPath, int pFileFormat);
[DispId(5)]
string WdFileSaveAsFormat2(string pPath, int pFileFormat);
}
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[Guid("DCCB8C80-9B57-45A9-A35B-DFCEB143FD96")]
public interface IPilotTestEvents
{
}
#region classe PilotTest
[ComVisible(true)]
[Guid("4741BF52-BB0C-4D4D-8806-D0732692B862")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IPilotTestEvents))]
[ProgId("PilotTest")]
// https://learn.microsoft.com/fr-fr/dotnet/standard/native-interop/qualify-net-types-for-interoperation?source=recommendations
//https://learn.microsoft.com/fr-fr/dotnet/standard/native-interop/com-callable-wrapper#introducing-the-class-interface
public class PilotTest : IPilotTest
{
string IPilotTest.wdFileOpen(string pPath)
{
var wDocumentTravail = new Aspose.Words.Document(pPath);
}
string IPilotTest.WdFileNew(string pNomModele, int pNuModele)
{
return "";
}
string IPilotTest.WdFileSaveAs(string pPath)
{
return "";
}
string IPilotTest.WdFileSaveAsFormat(string pPath, int pFileFormat)
{
//FPilotWord.WdFileSaveAsFormat(pPath, pFileFormat);
return "toto";
}
string IPilotTest.WdFileSaveAsFormat2(string pPath, int pFileFormat)
{
//FPilotWord.WdFileSaveAsFormat2(pPath, pFileFormat);
return "";
}
#endregion
#region Constructeur
public PilotTest()
{
// !!!!!
// Ne rien mettre car on appelle pas de constructeur de dll dans Diamic (logique). On passe ici qu'au niveau du testeur.
// !!!!!
}
#endregion Constructeur
}
@ghislaink Does the problem occur with all document or only with a specific one? If the problem occurs only with a specific document, please attach this document here for testing.
Have you tried opening the document using Aspose.Words provided ComHelper class in your Delphi project?
I tried with differents files and it is the same problem.
I tried (followin your advice) whith the ComHelper, and it is the same problem.
In the code following, I see well the messages and been stopped by the exception when trying the " comHelper.Open" => “floating point invalid operation”.
In addition, i use a Wpf project, with the same code and the same WinWord files to open and it is ok.
I hope you will able to help me …
// -----------------------------------------------------------------------------------
string IPilotTest.wdFileOpen(string pPath)
{
System.Windows.Forms.MessageBox.Show(pPath);
ComHelper comHelper = new ComHelper();
System.Windows.Forms.MessageBox.Show("comHelper.Open(pPath)");
var wDocumentTravail = comHelper.Open(pPath);
System.Windows.Forms.MessageBox.Show("Aspose.Words.DocumentBuilder");
ok … but open a document with aspose.word is not the purpose of my dev, but the start of more operations on the document : replace text, insert text and image, and so on.
I was expecting doing those things in visual / C#, being able to debug functionnalities before expose them by a dll com used in delphi.
Do you suggest, I can do the same with a OLEVariant object in Delphi ? Please give me few links to get samples. It will be great.
@ghislaink Yes, your approach with COM wrapper is correct and preferred for complex scenarios. I suggested the simple code with OLEVariant object in Delphi just for testing purposes.
Also, have you tried using your COM wrapper class in VB script? Again just for testing purposes, sine I suspect that the mentioned exception is Delphi specific and is not related to Aspose.Words itself.
I have found a similar problem. To resolve it, it was necessary to disable the Floating Point Exceptions by using Set8087CW($133f) or SetExceptionMask(exAllArithmeticExceptions):