static void FileIO_ReadFromWord(Args _args)
{ str document = "D:\\Demo Edition.doc";
COM wordApplication;
COM wordDocuments;
COM wordDoc;
COM range;
TextBuffer txt = new TextBuffer();
;
// Create instance of Word application
wordApplication = new COM("Word.Application");
// Get documents property
wordDocuments = wordApplication.Documents();
// Add document that you want to read
wordDoc = wordDocuments.add(document);
range = wordDoc.range();
txt.setText(range.text());
// to replace carriage return with newline char
txt.replace('\r', '\n');
}
Nice job! Have you tried to archieve the same results using Microsoft.Office.Interop.Word assemblies so you can use intellisense on MorphX? I'm trying it but it is not working quite well.
ReplyDeleteYes you can do that , But i suggest you to develop/build new assembly in C# and you can use the same in AX by creating reference in AOT.
ReplyDelete