SOL9 Sample: WordPublisher
|
1 Screenshot
2 Source code
/*
* WordPublisher.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
//2010/05/12
// This is a sample program to publish a WordDoc file as a file of format of 'html', 'txt', 'XPS' or 'PDF'.
//2012/05/11 Modified to use SOL::WordPublisher class.
#include <sol/office/WordPublisher.h>
#include <sol/Locale.h>
void _tmain(int argc, TCHAR** argv)
{
if (! (argc == 3 || argc ==4)) {
printf("Usage: WordPublisher.exe docPathName html|mhtml|rtf|txt|xps|pdf.\n");
printf("or: WordPublisher.exe docPathName savePathName html|mhtml|rtf|txt|xps|pdf.\n");
printf("Note: docPathName or savePathName can take a full or relative path.\n");
return;
}
Locale locale;
try {
const TCHAR* docPathName = argv[1];
const TCHAR* saveFormat = NULL;
WordPublisher publisher;
if (argc == 3) {
saveFormat = argv[2];
publisher.publish(docPathName, saveFormat);
}
if (argc == 4) {
const TCHAR* savePathName = argv[2];
saveFormat = argv[3];
publisher.publish(docPathName, savePathName, saveFormat);
}
} catch (HRESULT hr) {
printf("Exception %x\n", hr);
} catch (Exception& ex) {
ex.printf();
} catch (...) {
printf("Unknown Exception \n");
}
}
Last modified: 2 May 2016
Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.