Call ASPOSE.WORD java from MINGW C++

Hi !

Anyone having a simple example about how to call ASPOSE.Word (java) from a C++ MINGW ?

In the documentation, it is written that ASPOSE can be called from C++ but I did not find an simple example anywhere !!!

Thank you !

Hi,

Thanks for your inquiry. I think, in this case, you can use Aspose.Words via COM Interop. Please follow the link to learn how to achieve this:
https://docs.aspose.com/words/net/supported-platforms/#com

Moreover, you can find a code example in the following thread:
https://forum.aspose.com/t/using-embarcadero-c-builder/54833/2

I hope, this will help.

Best Regards,

Hi !

The first URL iwork fine but not the seconth one even though I connect with my userid !

Can you post the text ?

Thank you !

Hi,
Thanks for your inquiry. You can use Aspose.Words in your C++ project via COM interop.

#include 
#include // This is needed to work with COM objects.
#pragma hdrstop
#include "Unit2.h"
// ---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
// ---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
// ---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
// Create Aspose.Words.ComHelper. This object will help us to open an existing document.
Variant helper = Variant::CreateObject("Aspose.Words.ComHelper");
// Open an existing document.
Variant doc = helper.OleFunction("Open", "C:/Temp/in.doc");
Application->MessageBox(L"Document Opened Successfully.", L"Status", MB_OK);
// Do some manipulations with the document. You can use DocumentBuilder object to achieve this.
Variant builder = Variant::CreateObject("Aspose.Words.DocumentBuilder");
builder.OlePropertySet("Document", doc);
// Move DB cursor to the end of the document.
builder.OleProcedure("MoveToDocumentEnd");
// Insert some bold text into the document.
Variant font = builder.OlePropertyGet("Font");
font.OlePropertySet("Bold", true);
builder.OleProcedure("Write", "Hello World!!!");
// ..........
// Save document.
doc.OleProcedure("Save", "C:/Temp/out.docx");
Application->MessageBox(L"Document Saved Successfully", L"Status", MB_OK);
}

Hope this helps.

I will translate that using MINGW C++ and get back to let other interested people to know the solution to my problem !

Thank you !