mirror of https://github.com/tobya/DocTo
XLS to PDF Conversion
Now working, added test scripts and test file
This commit is contained in:
parent
25090ec1c4
commit
bb67728d79
BIN
exe/XlsTo.exe
BIN
exe/XlsTo.exe
Binary file not shown.
|
@ -69,7 +69,7 @@ function TExcelXLSConverter.DestroyOfficeApp: boolean;
|
||||||
begin
|
begin
|
||||||
if not VarIsEmpty(ExcelApp) then
|
if not VarIsEmpty(ExcelApp) then
|
||||||
begin
|
begin
|
||||||
ExcelApp.Quit();
|
ExcelApp.Quit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -80,18 +80,16 @@ begin
|
||||||
ExcelApp.Workbooks.Open( FileToConvert);
|
ExcelApp.Workbooks.Open( FileToConvert);
|
||||||
if OutputFileFormat = 50000 then //pdf
|
if OutputFileFormat = 50000 then //pdf
|
||||||
begin
|
begin
|
||||||
|
//Unlike Word, in Excel you must call a different function to save a pdf. Enusre we export entire workbook.
|
||||||
ExcelApp.activesheet.ExportAsFixedFormat(0, OutputFilename );
|
ExcelApp.activeWorkbook.ExportAsFixedFormat(0, OutputFilename );
|
||||||
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ExcelApp.activesheet.SaveAs( OutputFilename, OutputFileFormat);
|
ExcelApp.activeWorkbook.SaveAs( OutputFilename, OutputFileFormat);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ExcelApp.ActiveWorkbook.Close();
|
||||||
|
|
||||||
ExcelApp.activedocument.Close;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
<DCCReference Include="ResourceUtils.pas"/>
|
<DCCReference Include="ResourceUtils.pas"/>
|
||||||
<DCCReference Include="PathUtils.pas"/>
|
<DCCReference Include="PathUtils.pas"/>
|
||||||
<None Include="res\xlsFormats.txt"/>
|
<None Include="res\xlsFormats.txt"/>
|
||||||
|
<None Include="..\test\testxlsrun.bat"/>
|
||||||
<BuildConfiguration Include="Release">
|
<BuildConfiguration Include="Release">
|
||||||
<Key>Cfg_2</Key>
|
<Key>Cfg_2</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
|
@ -110,7 +111,7 @@
|
||||||
<Source Name="MainSource">XlsTo.dpr</Source>
|
<Source Name="MainSource">XlsTo.dpr</Source>
|
||||||
</Source>
|
</Source>
|
||||||
<Parameters>
|
<Parameters>
|
||||||
<Parameters Name="RunParams">-f "C:\Users\Toby\Documents\GitHub\DocTo\exe\test\InputFiles\TestXL.xls" -o "..\test\textxl.pdf" -t xlPDF</Parameters>
|
<Parameters Name="RunParams">-f "C:\Users\Toby\Documents\GitHub\DocTo\test\InputFiles\test2.xls" -o "c:\textxl.pdf" -t xlPDF</Parameters>
|
||||||
<Parameters Name="HostApplication">cmd</Parameters>
|
<Parameters Name="HostApplication">cmd</Parameters>
|
||||||
<Parameters Name="DebugCWD">C:\Users\Toby\Documents\GitHub\DocTo\exe</Parameters>
|
<Parameters Name="DebugCWD">C:\Users\Toby\Documents\GitHub\DocTo\exe</Parameters>
|
||||||
</Parameters>
|
</Parameters>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<BorlandProject>
|
<BorlandProject>
|
||||||
<Transactions>
|
<Transactions>
|
||||||
<Transaction>2013/04/24 18:01:01.000.075,C:\Users\Toby\Documents\RAD Studio\Projects\Project2.dproj=C:\Users\Toby\Documents\GitHub\DocTo\XlsTo.dproj</Transaction>
|
<Transaction>2013/04/24 18:01:01.000.075,C:\Users\Toby\Documents\GitHub\DocTo\XlsTo.dproj=C:\Users\Toby\Documents\RAD Studio\Projects\Project2.dproj</Transaction>
|
||||||
<Transaction>2013/04/24 20:20:07.291,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2013/04/24 20:20:07.000.291,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
||||||
<Transaction>2013/04/24 20:25:45.964,C:\Users\Toby\Documents\GitHub\DocTo\src\res\xlsFormats.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2013/04/24 20:25:45.000.964,C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\res\xlsFormats.txt</Transaction>
|
||||||
<Transaction>2013/04/24 20:27:56.086,C:\Users\Toby\Documents\GitHub\DocTo\src\xlsFormats.rc=C:\Users\Toby\Documents\GitHub\DocTo\src\wdFormats.rc</Transaction>
|
<Transaction>2013/04/24 20:27:56.000.086,C:\Users\Toby\Documents\GitHub\DocTo\src\wdFormats.rc=C:\Users\Toby\Documents\GitHub\DocTo\src\xlsFormats.rc</Transaction>
|
||||||
|
<Transaction>2013/04/25 22:19:38.863,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.bat</Transaction>
|
||||||
|
<Transaction>2013/04/25 22:19:55.558,C:\Users\Toby\Documents\GitHub\DocTo\test\testxlsrun.bat=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.bat</Transaction>
|
||||||
</Transactions>
|
</Transactions>
|
||||||
</BorlandProject>
|
</BorlandProject>
|
||||||
|
|
|
@ -2,30 +2,30 @@
|
||||||
<BorlandProject>
|
<BorlandProject>
|
||||||
<Transactions>
|
<Transactions>
|
||||||
<Transaction>2012/12/14 20:13:32.000.017,=C:\Users\Toby\Documents\GitHub\docto\New1.rc</Transaction>
|
<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\wdFormats.rc=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: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\res\wdFormats.txt=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>
|
||||||
<Transaction>2012/12/17 21:29:42.000.297,=C:\Users\Toby\Documents\GitHub\DocTo\readme.md</Transaction>
|
<Transaction>2012/12/17 21:29:42.000.297,=C:\Users\Toby\Documents\GitHub\DocTo\readme.md</Transaction>
|
||||||
<Transaction>2012/12/20 19:08:10.000.906,=C:\Users\Toby\Documents\GitHub\DocTo\src\res\wdFormats.txt</Transaction>
|
<Transaction>2012/12/20 19:08:10.000.906,=C:\Users\Toby\Documents\GitHub\DocTo\src\res\wdFormats.txt</Transaction>
|
||||||
<Transaction>2012/12/20 19:08:24.000.807,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2012/12/20 19:08:24.000.807,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
||||||
<Transaction>2012/12/20 19:10:43.000.407,C:\Users\Toby\Documents\GitHub\DocTo\src\res\HelpLog.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2012/12/20 19:10:43.000.407,C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\res\HelpLog.txt</Transaction>
|
||||||
<Transaction>2012/12/20 19:11:29.000.496,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
<Transaction>2012/12/20 19:11:29.000.496,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
||||||
<Transaction>2012/12/20 19:11:39.000.877,C:\Users\Toby\Documents\GitHub\DocTo\src\ResourceUtils.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
<Transaction>2012/12/20 19:11:39.000.877,C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\ResourceUtils.pas</Transaction>
|
||||||
<Transaction>2012/12/20 19:29:17.000.356,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
<Transaction>2012/12/20 19:29:17.000.356,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
||||||
<Transaction>2012/12/20 19:30:09.000.078,C:\Users\Toby\Documents\GitHub\DocTo\src\PathUtils.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
<Transaction>2012/12/20 19:30:09.000.078,C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\PathUtils.pas</Transaction>
|
||||||
<Transaction>2012/12/29 15:46:02.000.089,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2012/12/29 15:46:02.000.089,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
||||||
<Transaction>2012/12/29 15:46:27.000.368,C:\Users\Toby\Documents\GitHub\DocTo\src\res\HelpJSONLog.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2012/12/29 15:46:27.000.368,C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\res\HelpJSONLog.txt</Transaction>
|
||||||
<Transaction>2013/01/04 22:59:43.000.114,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
<Transaction>2013/01/04 22:59:43.000.114,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
||||||
<Transaction>2013/01/04 22:59:54.000.160,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit2.pas</Transaction>
|
<Transaction>2013/01/04 22:59:54.000.160,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit2.pas</Transaction>
|
||||||
<Transaction>2013/01/04 23:01:35.000.511,C:\Users\Toby\Documents\GitHub\DocTo\src\Unit2.dfm=C:\Users\Toby\Documents\GitHub\DocTo\src\dmmain.dfm</Transaction>
|
<Transaction>2013/01/04 23:01:35.000.511,C:\Users\Toby\Documents\GitHub\DocTo\src\dmmain.dfm=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit2.dfm</Transaction>
|
||||||
<Transaction>2013/01/04 23:01:35.000.511,C:\Users\Toby\Documents\GitHub\DocTo\src\Unit2.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\dmmain.pas</Transaction>
|
<Transaction>2013/01/04 23:01:35.000.511,C:\Users\Toby\Documents\GitHub\DocTo\src\dmmain.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit2.pas</Transaction>
|
||||||
<Transaction>2013/01/05 00:02:58.000.285,C:\Users\Toby\Documents\GitHub\DocTo\src\dmmain.pas=</Transaction>
|
<Transaction>2013/01/05 00:02:58.000.285,C:\Users\Toby\Documents\GitHub\DocTo\src\dmmain.pas=</Transaction>
|
||||||
<Transaction>2013/01/05 10:08:48.000.600,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2013/01/05 10:08:48.000.600,=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
||||||
<Transaction>2013/01/05 10:08:58.000.358,C:\Users\Toby\Documents\GitHub\DocTo\src\res\HelpWebHook.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt</Transaction>
|
<Transaction>2013/01/05 10:08:58.000.358,C:\Users\Toby\Documents\GitHub\DocTo\src\New1.txt=C:\Users\Toby\Documents\GitHub\DocTo\src\res\HelpWebHook.txt</Transaction>
|
||||||
<Transaction>2013/04/24 09:35:15.000.709,=C:\Users\Toby\Documents\GitHub\DocTo\src\docto.todo</Transaction>
|
<Transaction>2013/04/24 09:35:15.000.709,=C:\Users\Toby\Documents\GitHub\DocTo\src\docto.todo</Transaction>
|
||||||
<Transaction>2013/04/24 09:37:43.000.874,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
<Transaction>2013/04/24 09:37:43.000.874,=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
||||||
<Transaction>2013/04/24 09:41:59.000.335,C:\Users\Toby\Documents\GitHub\DocTo\src\ExcelUtils.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas</Transaction>
|
<Transaction>2013/04/24 09:41:59.000.335,C:\Users\Toby\Documents\GitHub\DocTo\src\Unit1.pas=C:\Users\Toby\Documents\GitHub\DocTo\src\ExcelUtils.pas</Transaction>
|
||||||
<Transaction>2013/04/24 20:27:56.100,C:\Users\Toby\Documents\GitHub\DocTo\src\xlsFormats.rc=C:\Users\Toby\Documents\GitHub\DocTo\src\wdFormats.rc</Transaction>
|
<Transaction>2013/04/24 20:27:56.000.100,C:\Users\Toby\Documents\GitHub\DocTo\src\wdFormats.rc=C:\Users\Toby\Documents\GitHub\DocTo\src\xlsFormats.rc</Transaction>
|
||||||
</Transactions>
|
</Transactions>
|
||||||
<ProjectSortOrder AutoSort="0" SortType="0">
|
<ProjectSortOrder AutoSort="0" SortType="0">
|
||||||
<File Path="..\..\DocTo"/>
|
<File Path="..\..\DocTo"/>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -9,24 +9,26 @@ REM %~d0 and %~p0 together give the full directory this batch file is executing
|
||||||
|
|
||||||
|
|
||||||
REM Individually try each format on Test Document
|
REM Individually try each format on Test Document
|
||||||
REM FOR /F "eol=; tokens=1,2* delims=, " %%i in (testdata.txt) do "../exe/docto.exe" -f "%~d0%~p0\Inputfiles\pie3.doc" -o "%~d0%~p0GeneratedFiles\pie3out_%%i.%%j" -T %%i
|
FOR /F "eol=; tokens=1,2* delims=, " %%i in (testdata.txt) do "../exe/docto.exe" -f "%~d0%~p0\Inputfiles\pie3.doc" -o "%~d0%~p0GeneratedFiles\pie3out_%%i.%%j" -T %%i
|
||||||
|
|
||||||
"../exe/xlsto.exe" -f "%~d0%~p0Inputfiles\" -o "%~d0%~p0GeneratedFiles" -T wdFormatPDF -OX pdf
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
REM Try on Directory
|
REM Try on Directory
|
||||||
REM"../exe/docto.exe" -f "%~d0%~p0Inputfiles\" -o "%~d0%~p0GeneratedFiles" -T wdFormatPDF -OX pdf
|
"../exe/docto.exe" -f "%~d0%~p0Inputfiles\" -o "%~d0%~p0GeneratedFiles" -T wdFormatPDF -OX pdf
|
||||||
|
|
||||||
REM Should produce an error
|
REM Should produce an error
|
||||||
REM"../exe/docto.exe" -f "%~d0%~p0Inputfiles\pie3.doc" -o "%~d0%~p0GeneratedFiles\Pie3.pdf" -T wdFormatTestPDF
|
"../exe/docto.exe" -f "%~d0%~p0Inputfiles\pie3.doc" -o "%~d0%~p0GeneratedFiles\Pie3.pdf" -T wdFormatTestPDF
|
||||||
|
|
||||||
REM Should produce an error
|
REM Should produce an error
|
||||||
REM"../exe/docto.exe" -f "%~d0%~p0Inputfiles\pie3_doesntexist.doc" -o "%~d0%~p0GeneratedFiles\Pie3.pdf" -T wdFormatPDF
|
"../exe/docto.exe" -f "%~d0%~p0Inputfiles\pie3_doesntexist.doc" -o "%~d0%~p0GeneratedFiles\Pie3.pdf" -T wdFormatPDF
|
||||||
|
|
||||||
REM Test Webhook
|
REM Test Webhook
|
||||||
REM *********************************
|
REM *********************************
|
||||||
REM To view visit http://toflidium.com/webhooks/docto/docto_test_values.txt
|
REM To view visit http://toflidium.com/webhooks/docto/docto_test_values.txt
|
||||||
REM *********************************
|
REM *********************************
|
||||||
REM"../exe/docto.exe" -f "%~d0%~p0Inputfiles\pie3.doc" -o "%~d0%~p0GeneratedFiles\Pie3.pdf" -T wdFormatPDF -W http://toflidium.com/webhooks/docto/webhook_test.php
|
"../exe/docto.exe" -f "%~d0%~p0Inputfiles\pie3.doc" -o "%~d0%~p0GeneratedFiles\Pie3.pdf" -T wdFormatPDF -W http://toflidium.com/webhooks/docto/webhook_test.php
|
||||||
|
|
||||||
|
|
||||||
|
REM XLSTO
|
||||||
|
|
||||||
|
REM Try on Directory
|
||||||
|
"../exe/xlsto.exe" -f "%~d0%~p0Inputfiles\" -o "%~d0%~p0GeneratedFiles" -T xlPDF -OX .pdf
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
REM XLSTO
|
||||||
|
|
||||||
|
REM Try on Directory
|
||||||
|
"../exe/xlsto.exe" -f "%~d0%~p0Inputfiles\" -o "%~d0%~p0GeneratedFiles" -T xlPDF -OX .pdf
|
Loading…
Reference in New Issue