mirror of https://github.com/tobya/DocTo
commit
3dcd8d8b67
|
@ -0,0 +1,22 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
|
@ -0,0 +1,176 @@
|
|||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.vspscc
|
||||
.builds
|
||||
*.dotCover
|
||||
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment this
|
||||
#packages/
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish
|
||||
|
||||
# Others
|
||||
[Bb]in
|
||||
[Oo]bj
|
||||
sql
|
||||
TestResults
|
||||
*.Cache
|
||||
ClientBin
|
||||
stylecop.*
|
||||
~$*
|
||||
*.dbmdl
|
||||
Generated_Code #added for RIA/Silverlight projects
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
|
||||
|
||||
|
||||
############
|
||||
## Windows
|
||||
############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
############
|
||||
# Delphi
|
||||
############
|
||||
|
||||
__history/
|
||||
*.~*
|
||||
*.dcu
|
||||
*.exe
|
||||
*.identcache
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,283 @@
|
|||
unit MainUtils;
|
||||
(*************************************************************
|
||||
Copyright © 2012 Toby Allen (http://github.com/tobya)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice, and every other copyright notice found in this software, and all the attributions in every file, and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
****************************************************************)
|
||||
interface
|
||||
uses classes, WordUtils, sysutils, ActiveX, ComObj;
|
||||
|
||||
type
|
||||
TConsoleLog = class
|
||||
public
|
||||
procedure Log(Sender: TObject; Log : String);
|
||||
|
||||
end;
|
||||
|
||||
TDocumentConverter = class
|
||||
private
|
||||
Formats : TStringlist;
|
||||
FOutputFileFormatString: String;
|
||||
FOutputFileFormat: Integer;
|
||||
FOutputLog: Boolean;
|
||||
FOutputFile: String;
|
||||
FInputFile: String;
|
||||
FOutputLogFile: String;
|
||||
ConsoleLog : TConsoleLog;
|
||||
procedure SetInputFile(const Value: String);
|
||||
procedure SetOutputFile(const Value: String);
|
||||
procedure SetOutputFileFormat(const Value: Integer);
|
||||
procedure SetOutputFileFormatString(const Value: String);
|
||||
procedure SetOutputLog(const Value: Boolean);
|
||||
procedure SetOutputLogFile(const Value: String);
|
||||
public
|
||||
|
||||
Constructor Create();
|
||||
Destructor Destroy();
|
||||
procedure LoadConfig(Params: TStrings);
|
||||
|
||||
procedure Log(Msg: String);
|
||||
function Execute() : string;
|
||||
property OutputLog : Boolean read FOutputLog write SetOutputLog;
|
||||
property OutputLogFile : String read FOutputLogFile write SetOutputLogFile;
|
||||
Property InputFile : String read FInputFile write SetInputFile;
|
||||
Property OutputFile : String read FOutputFile write SetOutputFile;
|
||||
Property OutputFileFormat : Integer read FOutputFileFormat write SetOutputFileFormat;
|
||||
Property OutputFileFormatString : String read FOutputFileFormatString write SetOutputFileFormatString;
|
||||
end;
|
||||
|
||||
function IsNumber(Str: String) : Boolean;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
{ TConsoleLog }
|
||||
|
||||
procedure TConsoleLog.Log(Sender: TObject; Log: String);
|
||||
begin
|
||||
|
||||
|
||||
Writeln(Log);
|
||||
|
||||
end;
|
||||
|
||||
constructor TDocumentConverter.Create;
|
||||
begin
|
||||
ConsoleLog := TConsoleLog.Create();
|
||||
end;
|
||||
|
||||
destructor TDocumentConverter.Destroy;
|
||||
begin
|
||||
ConsoleLog.Free;
|
||||
end;
|
||||
|
||||
function TDocumentConverter.Execute: string;
|
||||
var
|
||||
WordApp : OleVariant;
|
||||
begin
|
||||
log('Ready to Execute');
|
||||
try
|
||||
try
|
||||
Wordapp := CreateOleObject('Word.Application');
|
||||
Wordapp.Visible := false;
|
||||
Wordapp.documents.Open(InputFile);
|
||||
Wordapp.activedocument.Saveas(OutputFile ,OutputFileFormat);
|
||||
Wordapp.activedocument.Close;
|
||||
wordapp.quit();
|
||||
result := OutputFile;
|
||||
except on E: Exception do
|
||||
log(E.ClassName + ' ' + e.Message);
|
||||
|
||||
end;
|
||||
finally
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
procedure TDocumentConverter.LoadConfig(Params: TStrings);
|
||||
var i, f , iParam, idx: integer;
|
||||
pstr : string;
|
||||
id, value : string;
|
||||
|
||||
begin
|
||||
|
||||
Formats := AvailableWordFormats();
|
||||
|
||||
(* TConsoleLog.Log(self,Formats.Text);
|
||||
|
||||
for f := 0 to Formats.Count -1 do
|
||||
begin
|
||||
TConsoleLog.Log(self,Formats.Names[f] + '::');
|
||||
end; *)
|
||||
|
||||
//Defaults
|
||||
OutputLog := true;
|
||||
OutputLogFile := '';
|
||||
|
||||
log('Loading Configuration...');
|
||||
log('Parameter Count is ' + inttostr(params.Count));
|
||||
|
||||
if Params.Count = 0 then
|
||||
begin
|
||||
log('Parameters Expected: -H for help');
|
||||
halt(1);
|
||||
end ;
|
||||
|
||||
|
||||
While iParam <= Params.Count -1 do
|
||||
begin
|
||||
pstr := Params[iParam];
|
||||
|
||||
id := UpperCase( pstr);
|
||||
if ParamCount -1 > iParam then
|
||||
begin
|
||||
value := Trim(Params[iParam +1]);
|
||||
end;
|
||||
inc(iParam,2);
|
||||
|
||||
|
||||
if id = '-O' then
|
||||
begin
|
||||
FOutputFile := value;
|
||||
log('Output file is : ' + FOutputFile);
|
||||
end
|
||||
else if id = '-F' then
|
||||
begin
|
||||
FInputFile := value;
|
||||
log('Input File is : ' + FInputFile);
|
||||
end
|
||||
else if id = '-T' then
|
||||
begin
|
||||
|
||||
if IsNumber(value) then
|
||||
begin
|
||||
FOutputFileFormat := strtoint(value);
|
||||
end
|
||||
else
|
||||
begin
|
||||
FOutputFileFormatString := value;
|
||||
|
||||
idx := formats.IndexOfName(FOutputFileFormatString);
|
||||
if idx > -1 then
|
||||
begin
|
||||
OutputFileFormat := strtoint(formats.Values[OutputFileFormatString]);
|
||||
|
||||
end
|
||||
else if idx = -1 then
|
||||
begin
|
||||
Log('File Format ' + OutputFileFormatString + ' is invalid, please see help. -h');
|
||||
halt(200);
|
||||
end;
|
||||
|
||||
|
||||
end;
|
||||
log('Type is: ' + inttostr(FOutputFileFormat));
|
||||
end
|
||||
else if (id = '-H') then
|
||||
begin
|
||||
Log('Help');
|
||||
Log('Command Line Params');
|
||||
log('Each Parameter should be followed by its value -f "c:\Docs\MyDoc.doc" -O "C:\MyDir\MyFile" ');
|
||||
log(' -H This message');
|
||||
log(' -F Input File or Directory');
|
||||
log(' -O Output File or Directory to place converted Docs');
|
||||
log(' -T Format to convert file to, either integer or wdSaveFormat constant. ');
|
||||
log(' Available from http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdsaveformat.aspx ');
|
||||
log(' See current List Below. ');
|
||||
log(' -L Log to file in directory');
|
||||
log(' ');
|
||||
log('FILE FORMATS');
|
||||
for f := 0 to Formats.Count -1 do
|
||||
begin
|
||||
log(Formats.Names[f] + '=' + Formats.Values[Formats.Names[f]]);
|
||||
end;
|
||||
|
||||
log('ERROR CODES:');
|
||||
log('200 : Invalid File Format specified');
|
||||
halt(2);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Log('Unknown:' + pstr);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TDocumentConverter.Log(Msg: String);
|
||||
begin
|
||||
if OutputLog then
|
||||
begin
|
||||
ConsoleLog.Log(self, Msg);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDocumentConverter.SetInputFile(const Value: String);
|
||||
begin
|
||||
FInputFile := Value;
|
||||
end;
|
||||
|
||||
procedure TDocumentConverter.SetOutputFile(const Value: String);
|
||||
begin
|
||||
FOutputFile := Value;
|
||||
end;
|
||||
|
||||
procedure TDocumentConverter.SetOutputFileFormat(const Value: Integer);
|
||||
begin
|
||||
FOutputFileFormat := Value;
|
||||
end;
|
||||
|
||||
procedure TDocumentConverter.SetOutputFileFormatString(const Value: String);
|
||||
begin
|
||||
FOutputFileFormatString := Value;
|
||||
end;
|
||||
|
||||
procedure TDocumentConverter.SetOutputLog(const Value: Boolean);
|
||||
begin
|
||||
FOutputLog := Value;
|
||||
end;
|
||||
|
||||
procedure TDocumentConverter.SetOutputLogFile(const Value: String);
|
||||
begin
|
||||
FOutputLogFile := Value;
|
||||
end;
|
||||
|
||||
function IsNumber(Str: String) : Boolean;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
Result := true;
|
||||
try
|
||||
i := strtoint(Str);
|
||||
|
||||
except
|
||||
Result := false;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
|
@ -0,0 +1,47 @@
|
|||
unit WordUtils;
|
||||
(*************************************************************
|
||||
Copyright © 2012 Toby Allen (http://github.com/tobya)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice, and every other copyright notice found in this software, and all the attributions in every file, and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
****************************************************************)
|
||||
interface
|
||||
uses Classes;
|
||||
|
||||
procedure LoadStringListFromResource(const ResName: string;SL : TStringList);
|
||||
function AvailableWordFormats() : TStringList;
|
||||
|
||||
implementation
|
||||
|
||||
function AvailableWordFormats() : TStringList;
|
||||
var
|
||||
Formats : TStringList;
|
||||
|
||||
begin
|
||||
Formats := Tstringlist.Create();
|
||||
LoadStringListFromResource('FORMATS',Formats);
|
||||
|
||||
result := Formats;
|
||||
end;
|
||||
|
||||
procedure LoadStringListFromResource(const ResName: string;SL : TStringList);
|
||||
var
|
||||
RS: TResourceStream;
|
||||
begin
|
||||
RS := TResourceStream.Create(HInstance, ResName, 'Text');
|
||||
try
|
||||
SL.LoadFromStream(RS);
|
||||
finally
|
||||
RS.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
|
@ -0,0 +1,38 @@
|
|||
-$A8
|
||||
-$B-
|
||||
-$C+
|
||||
-$D+
|
||||
-$E-
|
||||
-$F-
|
||||
-$G+
|
||||
-$H+
|
||||
-$I+
|
||||
-$J-
|
||||
-$K-
|
||||
-$L+
|
||||
-$M-
|
||||
-$N+
|
||||
-$O+
|
||||
-$P+
|
||||
-$Q-
|
||||
-$R-
|
||||
-$S-
|
||||
-$T-
|
||||
-$U-
|
||||
-$V+
|
||||
-$W-
|
||||
-$X+
|
||||
-$YD
|
||||
-$Z1
|
||||
-cg
|
||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
-H+
|
||||
-W+
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl"
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
|
@ -0,0 +1,136 @@
|
|||
[FileVersion]
|
||||
Version=7.0
|
||||
[Compiler]
|
||||
A=8
|
||||
B=0
|
||||
C=1
|
||||
D=1
|
||||
E=0
|
||||
F=0
|
||||
G=1
|
||||
H=1
|
||||
I=1
|
||||
J=0
|
||||
K=0
|
||||
L=1
|
||||
M=0
|
||||
N=1
|
||||
O=1
|
||||
P=1
|
||||
Q=0
|
||||
R=0
|
||||
S=0
|
||||
T=0
|
||||
U=0
|
||||
V=1
|
||||
W=0
|
||||
X=1
|
||||
Y=1
|
||||
Z=1
|
||||
ShowHints=1
|
||||
ShowWarnings=1
|
||||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
NamespacePrefix=
|
||||
SymbolDeprecated=1
|
||||
SymbolLibrary=1
|
||||
SymbolPlatform=1
|
||||
UnitLibrary=1
|
||||
UnitPlatform=1
|
||||
UnitDeprecated=1
|
||||
HResultCompat=1
|
||||
HidingMember=1
|
||||
HiddenVirtual=1
|
||||
Garbage=1
|
||||
BoundsError=1
|
||||
ZeroNilCompat=1
|
||||
StringConstTruncated=1
|
||||
ForLoopVarVarPar=1
|
||||
TypedConstVarPar=1
|
||||
AsgToTypedConst=1
|
||||
CaseLabelRange=1
|
||||
ForVariable=1
|
||||
ConstructingAbstract=1
|
||||
ComparisonFalse=1
|
||||
ComparisonTrue=1
|
||||
ComparingSignedUnsigned=1
|
||||
CombiningSignedUnsigned=1
|
||||
UnsupportedConstruct=1
|
||||
FileOpen=1
|
||||
FileOpenUnitSrc=1
|
||||
BadGlobalSymbol=1
|
||||
DuplicateConstructorDestructor=1
|
||||
InvalidDirective=1
|
||||
PackageNoLink=1
|
||||
PackageThreadVar=1
|
||||
ImplicitImport=1
|
||||
HPPEMITIgnored=1
|
||||
NoRetVal=1
|
||||
UseBeforeDef=1
|
||||
ForLoopVarUndef=1
|
||||
UnitNameMismatch=1
|
||||
NoCFGFileFound=1
|
||||
MessageDirective=1
|
||||
ImplicitVariants=1
|
||||
UnicodeToLocale=1
|
||||
LocaleToUnicode=1
|
||||
ImagebaseMultiple=1
|
||||
SuspiciousTypecast=1
|
||||
PrivatePropAccessor=1
|
||||
UnsafeType=0
|
||||
UnsafeCode=0
|
||||
UnsafeCast=0
|
||||
[Linker]
|
||||
MapFile=0
|
||||
OutputObjs=0
|
||||
ConsoleApp=1
|
||||
DebugInfo=0
|
||||
RemoteSymbols=0
|
||||
MinStackSize=16384
|
||||
MaxStackSize=1048576
|
||||
ImageBase=4194304
|
||||
ExeDescription=
|
||||
[Directories]
|
||||
OutputDir=
|
||||
UnitOutputDir=
|
||||
PackageDLLOutputDir=
|
||||
PackageDCPOutputDir=
|
||||
SearchPath=
|
||||
Packages=
|
||||
Conditionals=
|
||||
DebugSourceDirs=
|
||||
UsePackages=0
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=6153
|
||||
CodePage=1252
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
|
@ -0,0 +1,54 @@
|
|||
program docto;
|
||||
(*************************************************************
|
||||
Copyright © 2012 Toby Allen (http://github.com/tobya)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice, and every other copyright notice found in this software, and all the attributions in every file, and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
****************************************************************)
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
{$R 'wdFormats.res' 'wdFormats.rc'}
|
||||
|
||||
uses
|
||||
SysUtils,Classes, ActiveX,
|
||||
WordUtils in 'WordUtils.pas',
|
||||
MainUtils in 'MainUtils.pas';
|
||||
|
||||
var
|
||||
i : integer;
|
||||
paramlist : TStringlist;
|
||||
Logger : TConsoleLog;
|
||||
DocConv : TDocumentConverter;
|
||||
begin
|
||||
|
||||
paramlist := tstringlist.create;
|
||||
DocConv := TDocumentConverter.Create;
|
||||
try
|
||||
|
||||
for i := 1 to ParamCount do
|
||||
begin
|
||||
paramlist.Add(ParamStr(i));
|
||||
end;
|
||||
|
||||
DocConv.LoadConfig(paramlist);
|
||||
CoInitialize(nil);
|
||||
DocConv.log( DocConv.Execute);
|
||||
|
||||
|
||||
CoUninitialize;
|
||||
|
||||
|
||||
finally
|
||||
paramlist.Free;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
end.
|
|
@ -0,0 +1,118 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{2F967344-8067-49DA-9E3E-F6B7D7BC6CE5}</ProjectGuid>
|
||||
<MainSource>docto.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform>Win32</Platform>
|
||||
<AppType>Console</AppType>
|
||||
<FrameworkType>None</FrameworkType>
|
||||
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
|
||||
<ProjectVersion>12.2</ProjectVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias)</DCC_UnitAlias>
|
||||
<DCC_ImageBase>00400000</DCC_ImageBase>
|
||||
<DCC_N>true</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_DebugInformation>false</DCC_DebugInformation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="docto.dpr">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<RcCompile Include="wdFormats.rc">
|
||||
<ContainerId>RC</ContainerId>
|
||||
<ContainerId>RC</ContainerId>
|
||||
<Form>wdFormats.res</Form>
|
||||
</RcCompile>
|
||||
<DCCReference Include="WordUtils.pas"/>
|
||||
<DCCReference Include="MainUtils.pas"/>
|
||||
<None Include="res\wdFormats.txt"/>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
|
||||
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj"/>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>VCLApplication</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">docto.dpr</Source>
|
||||
</Source>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">6153</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"/>
|
||||
<VersionInfoKeys Name="FileDescription"/>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"/>
|
||||
<VersionInfoKeys Name="LegalCopyright"/>
|
||||
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||
<VersionInfoKeys Name="OriginalFilename"/>
|
||||
<VersionInfoKeys Name="ProductName"/>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"/>
|
||||
</VersionInfoKeys>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams">-f "d:\test\word\Pie1.doc" -O "d:\test\word\out\Pie1atxt.txt" -T wdFormatText</Parameters>
|
||||
</Parameters>
|
||||
</Delphi.Personality>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -0,0 +1,108 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{2F967344-8067-49DA-9E3E-F6B7D7BC6CE5}</ProjectGuid>
|
||||
<MainSource>docto.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform>Win32</Platform>
|
||||
<AppType>Console</AppType>
|
||||
<FrameworkType>None</FrameworkType>
|
||||
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;$(DCC_UnitAlias)</DCC_UnitAlias>
|
||||
<DCC_ImageBase>00400000</DCC_ImageBase>
|
||||
<DCC_N>true</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_DebugInformation>false</DCC_DebugInformation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="docto.dpr">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="WordUtils.pas"/>
|
||||
<DCCReference Include="MainUtils.pas"/>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<Import Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')" Project="$(BDS)\Bin\CodeGear.Delphi.Targets"/>
|
||||
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\8.0\UserTools.proj"/>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>VCLApplication</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">docto.dpr</Source>
|
||||
</Source>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">6153</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"/>
|
||||
<VersionInfoKeys Name="FileDescription"/>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"/>
|
||||
<VersionInfoKeys Name="LegalCopyright"/>
|
||||
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||
<VersionInfoKeys Name="OriginalFilename"/>
|
||||
<VersionInfoKeys Name="ProductName"/>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"/>
|
||||
</VersionInfoKeys>
|
||||
</Delphi.Personality>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<BorlandProject>
|
||||
<Transactions>
|
||||
<Transaction>2012/12/14 20:13:32.000.017,=C:\Users\Toby\Documents\GitHub\docto\New1.rc</Transaction>
|
||||
<Transaction>2012/12/14 20:14:07.000.617,C:\Users\Toby\Documents\GitHub\docto\New1.rc=C:\Users\Toby\Documents\GitHub\docto\wdFormats.rc</Transaction>
|
||||
<Transaction>2012/12/14 20:19:49.000.070,=C:\Users\Toby\Documents\GitHub\docto\New1.txt</Transaction>
|
||||
<Transaction>2012/12/14 20:20:09.000.697,C:\Users\Toby\Documents\GitHub\docto\New1.txt=C:\Users\Toby\Documents\GitHub\docto\res\wdFormats.txt</Transaction>
|
||||
</Transactions>
|
||||
</BorlandProject>
|
|
@ -0,0 +1,5 @@
|
|||
DocTo
|
||||
|
||||
Simple utility for converting a .doc file to any other supported format.
|
||||
|
||||
Must have Microsoft Word installed on host machine.
|
|
@ -0,0 +1,26 @@
|
|||
wdFormatDOSTextLineBreaks=5
|
||||
wdFormatEncodedText=7
|
||||
wdFormatFilteredHTML=10
|
||||
wdFormatFlatXML=19
|
||||
wdFormatFlatXML=20
|
||||
wdFormatFlatXMLTemplate=21
|
||||
wdFormatFlatXMLTemplateMacroEnabled=22
|
||||
wdFormatOpenDocumentText=23
|
||||
wdFormatHTML=8
|
||||
wdFormatRTF=6
|
||||
wdFormatStrictOpenXMLDocument=24
|
||||
wdFormatTemplate=1
|
||||
wdFormatText=2
|
||||
wdFormatTextLineBreaks=3
|
||||
wdFormatUnicodeText=7
|
||||
wdFormatWebArchive=9
|
||||
wdFormatXML=11
|
||||
wdFormatDocument97=0
|
||||
wdFormatDocumentDefault=16
|
||||
wdFormatPDF=17
|
||||
wdFormatTemplate97=1
|
||||
wdFormatXMLDocument=12
|
||||
wdFormatXMLDocumentMacroEnabled=13
|
||||
wdFormatXMLTemplate=14
|
||||
wdFormatXMLTemplateMacroEnabled=15
|
||||
wdFormatXPS=18
|
|
@ -0,0 +1 @@
|
|||
FORMATS TEXT \res\wdFormats.txt
|
Binary file not shown.
Loading…
Reference in New Issue