mirror of https://github.com/tobya/DocTo
AutoMacroRun now disabled by default, new parameter to switch on if required.
This commit is contained in:
parent
b0d182b6ba
commit
214ca312e7
|
@ -122,6 +122,7 @@ ERROR CODES:
|
|||
205 : Invalid Parameter Value
|
||||
220 : Word or COM Error
|
||||
221 : Word not Installed
|
||||
301 : Not Implemented
|
||||
400 : Unknown Error
|
||||
|
||||
````
|
|
@ -134,8 +134,7 @@ type
|
|||
FAppID : Integer;
|
||||
FPdfExportRange_Word: Integer;
|
||||
FuseISO190051 : Boolean;
|
||||
|
||||
|
||||
fDisableMacros : Boolean;
|
||||
|
||||
FOutputIsFile: Boolean;
|
||||
FOutputIsDir: Boolean;
|
||||
|
@ -515,6 +514,9 @@ begin
|
|||
FDocStructureTags := true;
|
||||
FBitmapMissingFonts := true;
|
||||
FInputFiles := TStringList.Create;
|
||||
fDisableMacros := true;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
destructor TDocumentConverter.Destroy;
|
||||
|
@ -1261,6 +1263,16 @@ if (id = '-XL') or
|
|||
LogVersionInfo(true);
|
||||
halt(2);
|
||||
|
||||
end
|
||||
else if (id = '--ENABLE-MACROAUTORUN') then
|
||||
begin
|
||||
fDisableMacros := false;
|
||||
if (OfficeAppName <> 'Word')then
|
||||
begin
|
||||
// Excel Application.EnableEvents = False
|
||||
// HaltWithError(301,'Parameter ' + id + ' not Implemented for ' + OfficeAppName );
|
||||
end;
|
||||
|
||||
end
|
||||
else if (id = '-X') or
|
||||
(id = '--HALTERROR') then
|
||||
|
|
|
@ -160,6 +160,12 @@ begin
|
|||
Result.InputFile := fileToConvert;
|
||||
logInfo('ExecuteConversion:' + fileToConvert, Verbose);
|
||||
|
||||
// disable auto macro
|
||||
if (fDisableMacros) then
|
||||
begin
|
||||
WordApp.WordBasic.DisableAutoMacros ;
|
||||
end;
|
||||
|
||||
// Check if document has password as per
|
||||
// https://wordmvp.com/FAQs/MacrosVBA/CheckIfPWProtectB4Open.htm
|
||||
// Always open with password, if none it will be ignored,
|
||||
|
@ -216,6 +222,7 @@ begin
|
|||
end;
|
||||
|
||||
|
||||
|
||||
// Encoding can be set. If a HTML type, then additional values
|
||||
// need to be set for Weboptions.encoding
|
||||
if Encoding = -1 then
|
||||
|
@ -346,9 +353,6 @@ begin
|
|||
// loginfo('FileCreated: ' + OutputFilename, STANDARD);
|
||||
finally
|
||||
|
||||
|
||||
|
||||
|
||||
// Close the document - do not save changes if doc has changed in any way.
|
||||
Wordapp.activedocument.Close(wdDoNotSaveChanges);
|
||||
end;
|
||||
|
|
|
@ -109,8 +109,9 @@ Long Parameters:
|
|||
--PDF-no-BitmapMissingFonts
|
||||
Do not bitmap missing fonts, fonts will be substituted.
|
||||
--use-ISO190051
|
||||
Create PDF to the ISO 19005-1 standard.
|
||||
|
||||
Create PDF to the ISO 19005-1 standard.
|
||||
--enable-macroautorun
|
||||
By Default any autorun Macros will not run, use this parameter if you wish Macros to Autorun. Word Only.
|
||||
|
||||
|
||||
|
||||
|
@ -130,4 +131,5 @@ ERROR CODES:
|
|||
205 : Invalid Parameter Value
|
||||
220 : Word or COM Error
|
||||
221 : Word not Installed
|
||||
301 : Not Implemented
|
||||
400 : Unknown Error
|
||||
|
|
Loading…
Reference in New Issue