Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6170767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:05:47+00:00 2026-05-23T23:05:47+00:00

I am using (in a Delphi win32 application) OLE to perform search and replace

  • 0

I am using (in a Delphi win32 application) OLE to perform search and replace in Word Documents.

THe user prepares a file with some textual tags enclosing them in “{” and “}” and saves the file.

Something like

Dear {NAME},

I want to tell you {WHAT_I_DID_LAST_WEEK}

Of course NAME and WHAT_I_DID_LAST_WEEK are DB fields that can be longer than 255.

So now by using Search and replace with OLE i get a STRING PARAMETER TOO LONG error (it seems 255 is the longest string usable there).

Is there an easy way to get rid of the problem?

Some home made solutons I thought of are:

1) truncate to 255 (good one 😉 ) may be appending “…” at the end

2) for every “tag” that requires a replace of more than 255 chars I could first insert more tags like {WHAT_I_DID_LAST_WEEK_1}{WHAT_I_DID_LAST_WEEK_2}{WHAT_I_DID_LAST_WEEK_N} and then replace 255 chars at a time

(1) is a quick solution, at least user doesn’t recieve the error, but of course it is not very good

(2) would probably work but it is a workaround, I would prefer another solution.

May be another solution is not use OLE Serach&Replace but use another function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:05:49+00:00Added an answer on May 23, 2026 at 11:05 pm

    we use AWordApp.Selection.TypeText(strValue) and loop for replacing tags that have value string longer then 255 chars …

    
     var
      AWordApp: OLEVariant;
     ...
     AWordApp := CreateOleObject('Word.Application');
     ...
    
    if (Length(strValue) >  255) then
     begin
      bFound := AWordApp.Selection.Find.Execute(params...);
      while bFound do
       begin
        AWordApp.Selection.TypeText(strValue);
        bFound := AWordApp.Selection.Find.Execute(params...);
       end;
     end;
    
    

    regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Delphi 2010 to build a Win32 GUI application running on Windows
I am looking for some starting points integrating a Win32 Delphi application's data with
I have developed a few Delphi Win32 (currently using D2007) applications, which revolve around
I`m using Delphi 2009 and want to operate some XML data. I heard that
My team is maintaining a huge Client Server win32 Delphi application. It is a
I am using Delphi 2010, and when I created a console application that prints
Simple problem. I'm working on a Delphi 2007/WIN32 application which now uses MS Access
I'm trying to divide my monolithic, Delphi-Win32 app in libraries, so I get some
I'm using FastReport in Delphi Win32. When a FastReport is called, it is previewed
I would appreciate some suggestions about Help File Authoring (Win32). I know how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.