WPCubed Product Support

Fix for WPWordConv

After much searching I finally fixed the problem of WPWordConv.pas not working with the latest Office 2007 converters on Windows Vista. Below a snippet of code with the line that needs to be changed:
......
try
InitConverter(Application.Handle, PChar(Uppercase(Application.ExeName)));
GlobalOutStream := Output;
Output.Clear;
ghszSubset := StringToHandle('');
//WAS: ghszConvtrVersion := StringToHandle('Word 97');
ghszConvtrVersion := StringToHandle(GetFileDescription(FConverter));

//WAS: ghszFile := StringToHandle(InputFile);
ghszFile := StringToHandle(StringToOem(InputFile));
//GlobalBuffer := GlobalAlloc(GMEM_FIXED {GHND}, 1024 * 4); // Old line of code
GlobalBuffer := GlobalAlloc(GHND, 4096); //new line of code changed to work with Office 2007 converters.
FError := '';
if Mode = wpcnvExport then
begin
result_value := RtfToForeign(ghszFile, nil, GlobalBuffer, ghszConvtrVersion, @ReadCallback);
if result_value <> 0 then
FError := FError + ConvErrorStrings[abs(result_value)];
end
........

Someone who is more familar with the code may come up with another solution, but for me it appears to be working. I also checked it and it appears to work with Windows XP and Office 2003.

#1 ♥ 0
4.5k Views 3 users read 1 min

It is absolutely incredible what you found. Congratulations. Your solution helped me to solve a conversion problem that was making me crazy.

#2 ♥ 0
support

Hi,

Thank you for finding this solution for Office 2007,

Regards,

Julian

#3 ♥ 0
This category is archived. No new posts are possible.