Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Create Word Docs Using the Direct Office Component In Delphi on Windows

Winsoft’s Direct Office is a nice third party solution which bypasses the middle-man – namely Word – to create, open, and save DOCX documents.

DOCX is a standardized file format. It can be read using Libre Office, SoftMaker’s TextMaker and on-line Google Docs.

Installation

Steps:

  1. Download the trial version
  2. Unzip doffice.zip
  3. Find Winsoft.DirectOffice.dll in .\doffice\Delphi\ along with the corresponding licenses in \doffice\Licenses\

DirectOffice vs Word COM API: Less code

Using Direct Office, you can reduce the amount of steps, bloat and coding to access Word Documents. Take for example, a simple operation of opening a document:

Direct OfficeMicrosoft Word COM API
Create DocumentCheck if Word is Open or Not.
If Word is not open, launch Word.
Check if Document is Open or Not.
If Document is not Open, Open it.
Check if View is in correct mode (Print View, Draft View…)
If not in correct view, change it accordingly.
Append PageInsert Page

Using the Word COM API, this is at least 35 lines of code. This includes exception checks, querying Word, if Word Document is already opened or not.

[crayon-67631e1c2c015159449090/]

In DirectOffice, access to Word Documents is less than 4 lines of code on average.

[crayon-67631e1c2c01c658531816/]

DirectOffice vs Word COM API: Speed

What if I told you, you could create and save Word Documents between 110% to 500% faster than using Word itself?

[crayon-67631e1c2c01d610958442/]

The equivalent in DirectOffice:

[crayon-67631e1c2c01f393237187/]

The estimated time to run the above code in Word for a lenghtly document, is ~ 3 minutes. If you were doing data-processing on a large document, it could possibly take upwards between 30 minutes to days.

The estimated time to run the above code in Direct Office is in seconds.

If your customer does not have Microsoft Word installed, or using a competing Word Processor, such as Google Docs or Libre Office, your applications built using DirectOffice can still function. Prior installation of Office or Word is not necessary.

Winsoft sells the full-version at the website, which can open Word, Excel and PowerPoint documents. Your customer’s time is important. Which solution will you choose?

Head over and check out the full WINSOFT Direct Office library for Delphi and C++Builder

Like what you see? You can get Direct Office and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4 today!

Exit mobile version