RTollison 0 Posted February 8 I have a very old project for interfacing with Word. Originally done when i had Word 97 and 2003 later. Created dot file in 97-03 format and all worked great. now i am adding some extra stuff to the old project BUT with my new activex/dll i get a different format when loading up the old dot files. paragraph spacing, default font. it's like it doesn't care about the dot being in an older format. but when i revert back to the original compiled activex/dll it works. same font, same paragraph spacing. what would i look for as the trigger for old 97-03 format versus new format. the dot has times font but when i load it up using new compiled dll i get Calibri (default for new session in WORD) but the older dll will keep it as Times. Share this post Link to post
JonRobertson 72 Posted February 8 Has anything changed in the Delphi environment between the "original compiled dll" and the one you are testing? Such as version of Delphi and any third-party components? Is the DLL interfacing with Word through COM Automation? If so, are you using the component wrappers included with Delphi or something else? Are your tests with "original dll" and new dll each talking to the same version of Word on the same machine? Share this post Link to post
RTollison 0 Posted February 8 original delphi 5 new delphi 10.2 word ole automation - original was word 2003 new is word 365 i have been trying different things in the dll and found that if I change all calls of FSession.Word.Selection.Paste() to FSession.Word.Selection.PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting); it formats the same. but my page layout is off because original dot is 1 page and the newly created document is 2 pages. the last part of the dot is a salutation type text but instead of bottom of the document it goes to the top of the next page. but overall the text/spacing "seems" to be the same. Share this post Link to post
RTollison 0 Posted February 8 // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// Word = IWord; // *********************************************************************// // Interface: IWord // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {4261D89B-82E0-4ED7-8F71-BCEF8E6E267E} // *********************************************************************// IWord = interface(IDispatch) ['{4261D89B-82E0-4ED7-8F71-BCEF8E6E267E}'] function OpenSession(var ASessionID: Integer): Integer; safecall; function CloseSession(ASessionID: Integer): Integer; safecall; function ReleaseSession(ASessionID: Integer): Integer; safecall; function SessionCount: Integer; safecall; function OpenFile(ASessionID: Integer; AFilePath: OleVariant; var AFileID: Integer): Integer; safecall; .... Share this post Link to post
RTollison 0 Posted February 8 interface uses ActiveX; // *********************************************************************// // Declaration of Enumerations defined in Type Library // *********************************************************************// // Constants for enum WdMailSystem type WdMailSystem = TOleEnum; const wdNoMailSystem = $00000000; wdMAPI = $00000001; wdPowerTalk = $00000002; wdMAPIandPowerTalk = $00000003; // Constants for enum WdTemplateType type WdTemplateType = TOleEnum; const wdNormalTemplate = $00000000; wdGlobalTemplate = $00000001; wdAttachedTemplate = $00000002; // Consta ...... Share this post Link to post
RTollison 0 Posted February 8 <DCCReference Include="uMain.pas"> <CoClasses>Word</CoClasses> </DCCReference> ... lines above in the include for the .dproj for the project not my original project but handed off to me for some desired updates/features. Share this post Link to post
RTollison 0 Posted February 8 i think you helped me answer my stupid question. in 10.2 i do not have the Office 2000 options turned on. Share this post Link to post
JonRobertson 72 Posted February 8 5 minutes ago, RTollison said: in 10.2 i do not have the Office 2000 options turned on. When I code any Office app automation in Delphi using the bundled wrappers, I use the more recent one. There may be a reason to use the Office 2000 wrapper. But I've never had a reason to use the older version. Share this post Link to post
RTollison 0 Posted February 8 reason for the older one is that we committed to that version from the start and now our clients have 2000+ documents (for all clients not just one) and we would be the ones to reformat the dot to a dotx and update dl. so for now we will use old so that our clients will not overwhelm our support teams. Share this post Link to post
PeterBelow 238 Posted February 9 16 hours ago, RTollison said: original delphi 5 new delphi 10.2 word ole automation - original was word 2003 new is word 365 i have been trying different things in the dll and found that if I change all calls of FSession.Word.Selection.Paste() to FSession.Word.Selection.PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting); it formats the same. but my page layout is off because original dot is 1 page and the newly created document is 2 pages. the last part of the dot is a salutation type text but instead of bottom of the document it goes to the top of the next page. but overall the text/spacing "seems" to be the same. The problem is likely the huge jump in the Word versions. Newer Word versions use a different document format and plainly refuse to edit documents in ancient formats like Word97, although you can still view them (my latest version installed is Word 2016, so still much older than Word365). You may have to rebuild your template dot with the new Word version to get it to work as you want. Share this post Link to post