app.Version
Returns the version as a string. Use it to confirm which version you actually connected to.
Signature
Notes
Python example (runnable)
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & Initver = str(app.Version) # something like "21.3.0.755"
print("Full version: ", ver)
major = int(ver.split(".")[0]) # first segment = major version
if major >= 21:
print("supports every API in this reference")
else:
print("older build, some APIs may be missing")
It returns a string, not a number
app.Version is an application-level property returning a version
string, shaped like major.minor.build. The format is not consistent across releases —
some carry four segments, some include a parenthesised note. So the first rule is:
do not treat it as a number, and do not compare it to the digits in a ProgID.
The .21 in a ProgID is the COM registration major version. app.Version is
what the application reports about itself. Same release, different format — a string comparison will
eventually surprise you.
Where it actually earns its keep: proving what you connected to
When several versions coexist, the biggest unknown is "which CorelDRAW did I land on".
Dispatch does not guarantee it is the one you assumed, and CurVer may have
been rewritten by another version. app.Version is the only direct evidence.
So the practical use is not branching logic, it is logging:
import logging
import win32com.client
log = logging.getLogger(__name__)
app = win32com.client.Dispatch("CorelDRAW.Application")
log.info("connected to CorelDRAW %s", app.Version)
That one line saves half an hour the day something breaks. Most "this code works on my machine" reports are version differences.
Branching on version without breaking
Interface support does differ between releases: properties get added, method signatures change. When you need to branch, parse the major number and compare — and keep a path for unknown versions:
def major_of(ver_str):
# "24.0.0.0" -> 24; return None on unexpected formats instead of raising
try:
return int(str(ver_str).strip().split(".")[0])
except (ValueError, AttributeError):
return None
maj = major_of(app.Version)
if maj is None:
print("unparsable version string:", app.Version)
elif maj >= 24:
pass # newer path
else:
pass # older path
Treat "failed to parse" as a normal branch, not an exception. Version strings change format; code that parses them rigidly breaks on some future release.
Do not use it to test whether CorelDRAW is installed
Reading app.Version requires a working app object already in hand — if nothing is
installed or connected, you never reach this line. To test installation, read registry
CurVer; to test whether it is running, use the result of GetActiveObject.
Three separate questions: installed, running, which version.
Why version-to-year tables keep failing
The tables circulating online (X4=14, X5=15 … 2019=21, 2020=22, 2021=23, 2022=24) are broadly right for the early releases. Corel changed the numbering scheme later, and from 2023 onward those tables are often off by one or more.
The reliable route is to read the ProgID currently registered — it always points at something that actually exists. If you need a mapping, maintain your own table and add a line after each upgrade rather than committing it to memory.
Two details
- It is an application property. Document objects do not expose an equivalent "version of the app that opened me". If you need to know which release saved a document, that is a different question and a different answer.
- Different instances can report differently. If you hold two app objects — local and remote, or two machines — each reports its own version. In multi-instance scripts, log the version together with an instance identifier, or the log becomes unreadable.
About this section: Connection & Init
Connection & Init — connecting to CorelDRAW over COM.
- This section has 8 entries; this is one of them.
- See the full section index: Connection & Init
Other entries in this section
- pythoncom.CoInitialize()COM initialization; it goes on the first line of the script. Any threa
- win32com.client.Dispatch("CorelDRAW.Application.21")Connect by version number; 21 is CorelDRAW 2019. If CDR is already run
- app.Visible = TrueShows the CDR window. Setting it False is faster for batch runs, but k
- win32com.client.Dispatch("CorelDRAW.Application")No version number, so it binds to whatever version is registered as de
- win32com.client.GetActiveObject("CorelDRAW.Application.21")Attaches to an instance that is already open and never starts a new pr
- win32com.client.gencache.EnsureDispatch(progid)Once the constant cache exists you can write cdrTextShape instead of 6
- app.Quit()Closes CorelDRAW entirely. Don't call it at the end of a batch job — i