Thanks for the reply. In answer to your points:
1) We are using the Word 2000 automation interface because that is what is
supported by the tool in which the programs are developed (Borland Developer
Studio 2006). In this version, for instance, the OpenDataSource() method has
only 14 parameters rather than the current 16. However, we actually have
Office 2003 installed because this fixes some (though not all) other problems
to do with mail-merge.
2) I tried adding the registry key mentioned in the KB article - for Word 11
as well as Word 10 - but it makes no difference.
3) I don't think your suggestion for using .odc is feasible - the items in
the data source come from a variety of places. Many of them are retrieved
from an Ingres database via ODBC, but some are created on the fly by
application code. Anyway, I do not have the resources to rewrite and re-test
all the affected applications, not to mention retraining all the developers.
All I am trying to do is prevent Word from making wild (and wrong) guesses
about the content of a mail-merge data source - surely this is not an
unreasonable thing to expect ? I do note that even the latest implementation
of OpenDataSource() does not have an encoding parameter as Documents.Open()
has - this seems to be the real problem.
I will keep plugging away and let you know of any progress...
Jolyon
> All I am trying to do is prevent Word from making wild (and wrong) guesses
> about the content of a mail-merge data source - surely this is not an
> unreasonable thing to expect ?
> I do note that even the latest implementation
> of OpenDataSource() does not have an encoding parameter as
> Documents.Open()
> has - this seems to be the real problem.
Yes, I would also prefer it if Word let you specify the encoding and
everything could be kept very simple, but unfortunately
a. I don't work for Microsoft - I'm just a volunteer - so I am also stuck
with the way Word actually works.
b. the .odc approach is the only one I know that has a chance of solving
the specific problem you described in a reasonably simple way.
(FWIW
c. several of the parameters in OpenDataSource have no effect and are
probably only there because someone in the WordBasic era decided that
OpenDataSource would probably need much the same parameters as Open.
d. Arguably the whole problem with OpenDataSource, ODBC and OLE DB is that
between them they don't abstract the business of opening an arbitrary data
source anything like well enough. For example, even if you had a character
encoding parameter, Word would have to know that it would have to be able to
provide it to its external text converter via one mechanism, and to OLE DB
via another, and that would be data source-dependant. For example, when
opening a .txt file via OLE DB there is no parameter you can specify in the
connection string that says "use this character encoding".)
> 3) I don't think your suggestion for using .odc is feasible - the items in
> the data source come from a variety of places. Many of them are retrieved
[quoted text clipped - 3 lines]
> all the affected applications, not to mention retraining all the
> developers.
OK, but in your original post you described a specific situation where you
were creating a tab-separated temp file with barcode data and using that as
your data source - in that case I would hope that you be able to limit the
use of .odc to the specific situation where you are creating the data source
on-the-fly. If you're connecting on-the-fly using a library routine under
your control then if absolutely necessary you could consider adding a .odc
and an entry in a SCHEMA.INI on-the-fly as well. As far as the .odc is
concerned, it is in effect just a text file with the path name of the text
file's folder and the file name of the .txt file, i.e. no nasty binary stuff
to create, and the SCHEMA.INI is a standard .INI with one section per file.
> 1) We are using the Word 2000 automation interface because that is what is
> supported by the tool in which the programs are developed (Borland
[quoted text clipped - 5 lines]
> problems
> to do with mail-merge.
OK, I'm not sure whether using the Word 2000 interface would make any
difference as far as encoding issues are concerned, unless it prevented you
from using the OLE DB connectivity available in Word 2003 (in which case you
could not use the .odc approach), /or/ you needed to connect using DDE or
ODBC and the inability to specify the Subtype parameter prevented you from
doing that. I would have thought that with Borland you would be able to
specify a .olb or .tlb with the correct parameter list if necessary, somehow
or other (with the older versions of Delphi, for example, there was support
for the dispatch method of Automation and I don't think the compiler did any
type checking at all, but that approach may be significantly harder to use
in more recent versions, and/or with C++ rather than Delphi.
Peter Jamieson
> Thanks for the reply. In answer to your points:
>
[quoted text clipped - 83 lines]
>> >
>> > Peter Jamieson
Jolyon Cox - 21 May 2007 15:08 GMT
Peter,
My apologies - on re-checking, I noticed that I had inadvertently applied
the default code page registry fix under HKLM instead of HKCU. Doing it
under HKCU fixes the problem. Many thanks for the insight - I will re-rate
your original reply.
Just for the record, I have replied below to your latest points. Many
thanks again.
Jolyon
> > All I am trying to do is prevent Word from making wild (and wrong) guesses
> > about the content of a mail-merge data source - surely this is not an
[quoted text clipped - 11 lines]
> b. the .odc approach is the only one I know that has a chance of solving
> the specific problem you described in a reasonably simple way.
Fair enough - sorry, didn't mean to take out my frustrations on you...
> (FWIW
> c. several of the parameters in OpenDataSource have no effect and are
[quoted text clipped - 27 lines]
> file's folder and the file name of the .txt file, i.e. no nasty binary stuff
> to create, and the SCHEMA.INI is a standard .INI with one section per file.
OK - maybe I've misunderstood what is involved here - it's not an area I'm
familiar with...
> > 1) We are using the Word 2000 automation interface because that is what is
> > supported by the tool in which the programs are developed (Borland
[quoted text clipped - 17 lines]
> type checking at all, but that approach may be significantly harder to use
> in more recent versions, and/or with C++ rather than Delphi.
Yes, of course I could have faked up a interface definition for the latest
version if it would have fixed it, though it would be a bit tedious and
harder to maintain.