Recent

Author Topic: Open MS Word file in track changes mode  (Read 1339 times)

noszone

  • New Member
  • *
  • Posts: 27
Open MS Word file in track changes mode
« on: October 01, 2021, 10:52:05 am »
Does anyone knows if Word file can be opened in track changes mode? As per official docs there is no such command line argument. But from manual of document control software (Documenolog, 3d party), their app can do it.

How I can see this process:
-User is uploading a docx file to web server
-The other person have to approve or reject document
-Rejected document opening by agent.exe software in track changes mode. After edit send back to web server.
-Edited document can seen in web browser in preview on page (with edits, comments, etc).

All above steps is okay in my head (there is solution for them), but only the problem that:
-Rejected document opening by agent.exe software in track changes mode

The one idea is probably use document templates somehow? Any idea is welcome.
« Last Edit: October 01, 2021, 11:36:17 am by noszone »

noszone

  • New Member
  • *
  • Posts: 27
Re: Open MS Word file in track changes mode
« Reply #1 on: October 06, 2021, 08:50:57 am »
Found it..
The solution is to use https://wiki.lazarus.freepascal.org/Office_Automation

The example code for enable review mode:

Code: Pascal  [Select][+][-]
  1. program officAuto;
  2.  
  3. {$IFDEF FPC}
  4.   {$MODE Delphi}
  5. {$ELSE}
  6.   {$APPTYPE CONSOLE}
  7. {$ENDIF}
  8.  
  9. uses
  10.    SysUtils, Variants, ComObj;
  11.  
  12. var
  13.   Server, Connect : Variant;
  14.   oWord, oPara1, oPara2 : Variant;
  15.  
  16.   w:widestring;
  17.  
  18.   begin
  19.     if Assigned(InitProc) then
  20.     TProcedure(InitProc);
  21.  
  22.   try
  23.     Server := CreateOleObject('Word.Application');
  24.   except
  25.     WriteLn('Unable to start Word.');
  26.     Exit;
  27.   end;
  28.  
  29.  
  30.   // oWord := Server.Documents.Add;
  31.   w:= UTF8Decode('c:\mydoc.docx');
  32.   Server.Visible := True;  
  33.   Server.Documents.Open(w);
  34.   Server.ActiveDocument.TrackRevisions:=true;
  35.   //Server.ActiveDocument.ShowRevisions:=false;
  36. end.

 

TinyPortal © 2005-2018