1 Screenshot
2 Source code
/*
* WordApplet.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// This is a sample program to open and close a Word file by using SOL::WordApplet class.
#include <sol/office/WordApplet.h>
#include <sol/office/WordDocument.h>
#include <sol/BString.h>
void _tmain(int argc, TCHAR** argv)
{
if (argc !=2) {
printf("Usage: WordApplet.exe WordFileName\n");
return;
}
if (GetFileAttributes(argv[1]) == 0xffffffff) {
_tprintf(_T("File not found %s\n"), argv[1]);
return;
}
try {
BString docname = argv[1];
WordApplet applet;
try {
WordDocument document = applet.open((BSTR)docname, true);
printf("Opend a document %S\n", (BSTR)docname);
document.close();
printf("Closed a document\n");
} catch (HRESULT hr) {
printf("Exception %x\n", hr);
} catch (...) {
printf("Unknown Exception \n");
}
} catch (HRESULT hr) {
printf("Exception %x\n", hr);
} catch (...) {
printf("Unknown Exception \n");
}
}
Last modified: 2 May 2016
Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.