From f85f3860d30839006ad7b8c149e674cda4749e6c Mon Sep 17 00:00:00 2001 From: Toby Allen Date: Wed, 24 Dec 2025 09:04:51 +0000 Subject: [PATCH 1/4] more info --- companion/app/Services/CommandInfoService.php | 37 +++++++++++ .../generator_templates/AllParameters.md | 8 +++ .../ConvertSheetFromXLStotype.tpl.md | 64 +++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 companion/resources/generator_templates/ConvertSheetFromXLStotype.tpl.md diff --git a/companion/app/Services/CommandInfoService.php b/companion/app/Services/CommandInfoService.php index 7a0d65d..a60053f 100644 --- a/companion/app/Services/CommandInfoService.php +++ b/companion/app/Services/CommandInfoService.php @@ -369,6 +369,43 @@ public static function Commands () ], "Template" => "ConvertFromXLSToFileUNC.tpl.md" ], + + "ConvertXLSSheets" => [ + "Description" => "Convert Excel Spreadsheet Sheets to another file type", + "Title" => 'How do I Convert a single sheet in a Microsoft Excel Spreadsheet', + "Template" => "ConvertSheetFromXLStotype.tpl.md", + "Items" => [ + + + [ + "FileTypeExt" => 'PDF', + "FileTypeDescription" => 'Adobe PDF Format', + "FileFormat" => 'xlpdf', + "RelatedLinks" => [] + ], + [ + "FileTypeExt" => 'TXT', + "FileTypeDescription" => 'Text File', + "FileFormat" => 'xlTextWindows', + "RelatedLinks" => [] + ], + [ + "FileTypeExt" => 'HTML', + "FileTypeDescription" => 'HTML File', + "FileFormat" => 'xlHtml', + "RelatedLinks" => [] + ], + [ + "FileTypeExt" => 'xls', + "FileTypeTitleExtra" => '9795', + "FileTypeDescription" => 'Excel 97/95 format', + "FileFormat" => 'xlExcel9795', + "RelatedLinks" => [] + ] + + + ], + ], "ConvertPPTToFile" => [ "Description" => "Convert Microsoft PowerPoint Presentation to another file type", "Template" => "ConvertFromPPTToFile.tpl.md", diff --git a/companion/resources/generator_templates/AllParameters.md b/companion/resources/generator_templates/AllParameters.md index bdb455f..a61abeb 100644 --- a/companion/resources/generator_templates/AllParameters.md +++ b/companion/resources/generator_templates/AllParameters.md @@ -276,6 +276,14 @@ Do not bitmap missing fonts, fonts will be substituted. Create PDF to the ISO 19005-1 standard, also know as PDF-A or PDF Archive. +### Enable Macros + +By Default (v1.16) Macros are disabled in both Word and Excel. If for +some reason you need them to run you can use these parameters + +> --enable-macroautorun + + ### Special Case Parameters diff --git a/companion/resources/generator_templates/ConvertSheetFromXLStotype.tpl.md b/companion/resources/generator_templates/ConvertSheetFromXLStotype.tpl.md new file mode 100644 index 0000000..0c3cd87 --- /dev/null +++ b/companion/resources/generator_templates/ConvertSheetFromXLStotype.tpl.md @@ -0,0 +1,64 @@ +~~~~{ + "title" : "{{$Command->Title}} " +} + +{{$Command->Title}} +== + +How do I Convert a sheet from a Microsoft Excel Spreadsheet to a {{$Command->FileTypeDescription}} ({{$Command->FileTypeExt}}) ? +- + +It is very simple to convert a sheet from a Microsoft Excel Spreadsheet to a {{$Command->FileTypeExt}} file +on the command line using [Docto](https://github.com/tobya/docto). +You can also do this easily in Microsoft Excel, but sometimes it helps to be able to do it +from the command line. + +You need to add the `--sheets` parameter to specify the sheet you wish to export. + +The command line below shows how you can convert a Microsoft Excel Spreadsheet +Document to a {{$Command->FileTypeDescription}} file +- {{$Command->FileTypeExt}} and save it. + +Command Line +- + + ```` + docto -XL -f 'c:\path\Spreadsheet.xls' -o 'c:\path\Output\SheetPDF.{{$Command->FileTypeExt}}' -t {{$Command->FileFormat}} --sheets + ```` + + or easier to read + + ```` + docto -XL -f '\\MyServer\path\Spreadsheet.xls' + -o '\\\\myserver\path\Output\Spreadsheet.{{$Command->FileTypeExt}}' + -t {{$Command->FileFormat}} + ```` + +Command Line Explained +- + + - `{{$Params->appxl->cmd}}` {{$Params->appxl->desc}} + - `{{$Params->dashf->cmd}}` {{$Params->dashf->desc}} + - `{{$Params->dasho->cmd}}` {{$Params->dasho->desc}} + - `{{$Params->dasht->cmd}}` {{$Params->dasht->desc}} + + + + +Some other interesting commands +- + +You might find some of the following commands also interesting. + +@include('RelatedLinks') + +Other File Types Available for Conversion +- + +The following values below can be used to convert a Microsoft Excel Spreadsheet to another file type. + + +```` +{{$ResourceFiles['xlsFormats']['contents']}} +```` + From cb1e6d9a3c94d547a6eb91531c7f99a3f8ed7dae Mon Sep 17 00:00:00 2001 From: Toby Allen Date: Tue, 10 Feb 2026 14:26:35 +0000 Subject: [PATCH 2/4] sheet indexes 1 based --- src/MainUtils.pas | 1 + src/docto.dpr | 2 +- src/res/HelpLog.txt | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MainUtils.pas b/src/MainUtils.pas index 4027319..5d6694d 100644 --- a/src/MainUtils.pas +++ b/src/MainUtils.pas @@ -1290,6 +1290,7 @@ procedure TDocumentConverter.LoadConfig(Params: TStrings); END else if (id = '--SHEETS') then begin + // Sheet Indexs are 1 based. fSelectedSheets.DelimitedText := value; if fSelectedSheets.Count = 0 then begin diff --git a/src/docto.dpr b/src/docto.dpr index 5b540d7..565389c 100644 --- a/src/docto.dpr +++ b/src/docto.dpr @@ -1,6 +1,6 @@ program docto; (************************************************************* -Copyright © 2012-2016 Toby Allen (https://github.com/tobya) +Copyright © 2012-2026 Toby Allen (https://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 diff --git a/src/res/HelpLog.txt b/src/res/HelpLog.txt index eecaa26..94e7730 100644 --- a/src/res/HelpLog.txt +++ b/src/res/HelpLog.txt @@ -118,7 +118,7 @@ Long Parameters: --enable-xlvbaauto By Default any autorun vba will not run, use this parameter if you wish vba to Autorun. Word / Excel Only. --sheets - Select which sheets to save. Can be comma seperated list of sheet names or indexes. Excel Only. PDF Only + Select which sheets to save. Can be comma seperated list of sheet names or indexes. Index 1 Based. Excel Only. PDF Only --allsheets If converting to CSV default behaviour is to convert first sheet. This will convert all with appropriate names. PDF, CSV only From 0c3c7129fa8df29f4df34b7c3741244dfaaeb555 Mon Sep 17 00:00:00 2001 From: Toby Allen Date: Tue, 10 Feb 2026 14:56:53 +0000 Subject: [PATCH 3/4] tidy --- src/ExcelUtils.pas | 2 +- src/MainUtils.pas | 2 +- src/docto.dproj.local | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ExcelUtils.pas b/src/ExcelUtils.pas index c11ba22..a58a835 100644 --- a/src/ExcelUtils.pas +++ b/src/ExcelUtils.pas @@ -455,7 +455,7 @@ procedure TExcelXLSConverter.SaveAsPDF(OutputFilename : string) ; - logDebug('worksheetxx:' + ws.Name, VERBOSE); + logDebug('worksheet:' + ws.Name, VERBOSE); ExportWorkSheetasPDF(ws,FileNameGen); diff --git a/src/MainUtils.pas b/src/MainUtils.pas index 5d6694d..0799221 100644 --- a/src/MainUtils.pas +++ b/src/MainUtils.pas @@ -690,7 +690,7 @@ function TDocumentConverter.Execute: string; begin // logInfo('File Converted: ' + ConversionInfo.OutputFile); - logInfo('Files Converted: ' + fOutputFiles.Text); + logInfo('Files Converted: ' + sLineBreak + fOutputFiles.Text); // Check if file needs to be deleted. if RemoveFileOnConvert then diff --git a/src/docto.dproj.local b/src/docto.dproj.local index ea67e01..25748df 100644 --- a/src/docto.dproj.local +++ b/src/docto.dproj.local @@ -4,12 +4,12 @@ 2020/05/25 15:25:09.000.399,=D:\Development\GitHub\DocTo\src\res\HelpCompatibilityMode.txt 2020/05/25 15:31:23.000.508,D:\Development\GitHub\DocTo\src\res\WdCompatibilityMode.txt= 2021/12/02 22:25:13.000.761,=D:\Development\GitHub\DocTo\src\New1.bat - 2021/12/02 22:25:32.000.527,D:\Development\GitHub\DocTo\src\New1.bat=D:\Development\GitHub\DocTo\test\TestDocTo_Quiet.bat + 2021/12/02 22:25:32.000.527,D:\Development\GitHub\DocTo\test\TestDocTo_Quiet.bat=D:\Development\GitHub\DocTo\src\New1.bat 2023/09/11 17:39:20.000.384,=C:\Development\github\docto\src\res\xlsFormats.txt 2025/11/18 17:53:47.000.458,=C:\Development\github\docto\src\Unit1.pas - 2025/11/18 17:54:21.000.396,C:\Development\github\docto\src\shared\DynamicFileNameGenerator.pas=C:\Development\github\docto\src\Unit1.pas + 2025/11/18 17:54:21.000.396,C:\Development\github\docto\src\Unit1.pas=C:\Development\github\docto\src\shared\DynamicFileNameGenerator.pas 2025/11/19 14:43:02.000.361,=C:\Development\github\docto\src\Unit1.pas - 2025/11/19 14:43:31.000.175,C:\Development\github\docto\src\Exceptions\DocToExceptions.pas=C:\Development\github\docto\src\Unit1.pas + 2025/11/19 14:43:31.000.175,C:\Development\github\docto\src\Unit1.pas=C:\Development\github\docto\src\Exceptions\DocToExceptions.pas From 7c0cf65a0881d5a85ed4e28a07ca1745201c7dd2 Mon Sep 17 00:00:00 2001 From: Toby Allen Date: Tue, 10 Feb 2026 14:57:33 +0000 Subject: [PATCH 4/4] Ensure Tabs with spaces are selected. --- src/MainUtils.pas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MainUtils.pas b/src/MainUtils.pas index 0799221..735688f 100644 --- a/src/MainUtils.pas +++ b/src/MainUtils.pas @@ -33,7 +33,7 @@ interface MSVISIO = 4; - DOCTO_VERSION = '1.16.0'; // dont use 0x - choco needs incrementing versions. + DOCTO_VERSION = '1.16.2'; // dont use 0x - choco needs incrementing versions. DOCTO_VERSION_NOTE = ' x64 Release '; type @@ -1291,7 +1291,9 @@ procedure TDocumentConverter.LoadConfig(Params: TStrings); else if (id = '--SHEETS') then begin // Sheet Indexs are 1 based. - fSelectedSheets.DelimitedText := value; + + fSelectedSheets.StrictDelimiter := true; + fSelectedSheets.CommaText := value; if fSelectedSheets.Count = 0 then begin HaltWithConfigError(205,'Expecting > 0 selected sheets: ' + value);